OSDN Git Service

log: Fix an oob array read.
authorAlex Converse <aconverse@google.com>
Fri, 6 May 2011 05:33:31 +0000 (22:33 -0700)
committerAlex Converse <alex.converse@gmail.com>
Sun, 8 May 2011 20:34:05 +0000 (13:34 -0700)
libavutil/log.c

index ddfd31f..c44130c 100644 (file)
@@ -104,7 +104,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
 
     vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl);
 
-    print_prefix= line[strlen(line)-1] == '\n';
+    print_prefix = strlen(line) && line[strlen(line)-1] == '\n';
 
 #if HAVE_ISATTY
     if(!is_atty) is_atty= isatty(2) ? 1 : -1;