Skip to content

Commit

Permalink
Validate fromat pointer before calling va functions. Fix #5
Browse files Browse the repository at this point in the history
  • Loading branch information
JiapengLi committed Sep 1, 2016
1 parent 75b5113 commit bd40925
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ void log_puts(int priority, const char *format, ...)
}
#endif

va_list va;
va_start(va, format);
//printf("%s\t", category);
vprintf(format, va);

if(format != NULL){
va_list va;
va_start(va, format);
vprintf(format, va);
}
#ifdef WIN32
/* Restore original attributes */
SetConsoleTextAttribute(hConsole, saved_attributes);
Expand Down Expand Up @@ -210,13 +210,13 @@ void log_hex(int priority, const uint8_t *buf, int len, const char *format, ...)
}
#endif

va_list va;
va_start(va, format);
//printf("%s\t", category);
vprintf(format, va);

if( (format != NULL) && (0 != strlen(format)) ){
printf(" ");
if(format != NULL){
va_list va;
va_start(va, format);
vprintf(format, va);
if( 0 != strlen(format) ){
printf(" ");
}
}

for(i=0; i<len; i++){
Expand Down

0 comments on commit bd40925

Please sign in to comment.