src/nhttpd/yhttpd_core/helper.cpp revert unneeded sie check

This commit is contained in:
Jacek Jendrzej
2016-03-02 13:41:09 +01:00
parent 55fe41a626
commit 9c2fbfd0bb

View File

@@ -81,14 +81,7 @@ std::string timeString(time_t time) {
//-------------------------------------------------------------------------
std::string string_printf(const char *fmt, ...) {
va_list arglist;
va_start (arglist, fmt);
int len = vsnprintf (NULL, 0, fmt, arglist);
va_end (arglist);
const int bufferlen = 4*1024;
if(len >= bufferlen){
printf("string_printf: error: buffer overflow : len %i line %i\n",len,__LINE__);
return "error";
}
char buffer[bufferlen] = {0};
va_start(arglist, fmt);
vsnprintf(buffer, bufferlen, fmt, arglist);