src/nhttpd: fix segfault if logging on

This commit is contained in:
satbaby
2012-12-07 11:13:51 +01:00
parent 2fbe881180
commit fe16513b4f
3 changed files with 7 additions and 3 deletions

View File

@@ -77,7 +77,10 @@ void CLogging::printf(const char *fmt, ...) {
va_end(arglist);
pthread_mutex_lock(&Log_mutex);
::printf(buffer);
buffer[bufferlen-1]='\0';
::printf("%s",buffer);
fflush(stdout);
if (LogToFile) {
; //FIXME Logging to File
}

View File

@@ -65,6 +65,8 @@ bool CmAuth::CheckAuth(CyhookHandler *hh) {
// decode Base64 buffer to String
//-----------------------------------------------------------------------------
std::string CmAuth::decodeBase64(const char *b64buffer) {
if(b64buffer==NULL)
return "";
char *newString; //shorter then b64buffer
std::string result;
if ((newString = (char *) malloc(sizeof(char) * strlen(b64buffer) + 1))

View File

@@ -330,8 +330,7 @@ std::string CyParser::cgi_cmd_parsing(CyhookHandler *hh,
if (ydebug)
hh->printf("[ycgi debug]: CMD:[%s]<br/>\n", ycmd.c_str());
yresult = YWeb_cgi_cmd(hh, ycmd); // 4. execute cmd
// log_level_printf(5, "<yLoop>: ycmd...:%s\n", ycmd.c_str());//FIXME <tr class="%ctimer"> <td>%s</td> <td>%s</td> ... segfault
log_level_printf(5, "<yLoop>: ycmd...:%s\n", ycmd.c_str());
log_level_printf(6, "<yLoop>: yresult:%s\n", yresult.c_str());
if (ydebug)
hh->printf("[ycgi debug]: RESULT:[%s]<br/>\n",