[dvblast-devel] [PATCH 05/20] Do not initialize mrtg functionality if mrtg file is not set.

Georgi Chorbadzhiyski gf at unixsol.org
Mon Sep 5 09:52:40 CEST 2011


mrtgInit() is not checking if filename parameter is NULL so
when dvblast is run without -Z option that sets mrtg file
the following error is seen in valgrind:

 Syscall param open(filename) points to unaddressable byte(s)
    at 0x412798E: __open_nocancel (in /lib/libc-2.13.so)
    by 0x40BCA33: __fopen_internal (in /lib/libc-2.13.so)
    by 0x40BCA9B: fopen@@GLIBC_2.1 (in /lib/libc-2.13.so)
    by 0x8062841: mrtgInit (mrtg-cnt.c:167)
    by 0x4073DB5: (below main) (in /lib/libc-2.13.so)
---
 mrtg-cnt.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/mrtg-cnt.c b/mrtg-cnt.c
index 258bf64..0ba2c66 100644
--- a/mrtg-cnt.c
+++ b/mrtg-cnt.c
@@ -161,6 +161,8 @@ int mrtgAnalyse(block_t * p_ts)
 
 int mrtgInit(char *mrtg_file)
 {
+    if ( !mrtg_file )
+        return -1;
 
     /* Open MRTG file */
     msg_Dbg(NULL, "Opening mrtg file %s.\n", mrtg_file);
-- 
1.7.5.1



More information about the dvblast-devel mailing list