cmdutils_read_file: increment *size after writing the trailing \0
authorJanne Grunau <janne-libav@jannau.net>
Tue, 9 Oct 2012 15:55:32 +0000 (17:55 +0200)
committerJanne Grunau <janne-libav@jannau.net>
Tue, 9 Oct 2012 16:43:30 +0000 (18:43 +0200)
Fixes CID732166.

cmdutils.c

index 3ae48e4..ac971df 100644 (file)
@@ -1061,7 +1061,7 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
             ret = AVERROR_EOF;
     } else {
         ret = 0;
-        (*bufptr)[*size++] = '\0';
+        (*bufptr)[(*size)++] = '\0';
     }
 
     fclose(f);