From: Robert Schwebel Date: Sat, 29 Oct 2011 19:13:38 +0200 Subject: [PATCH] add nullpointer check Patch taken from redhat. Signed-off-by: Robert Schwebel --- efax.c | 1 + efaxos.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/efax.c b/efax.c index bdcd462..28f7fca 100644 --- a/efax.c +++ b/efax.c @@ -2186,6 +2186,7 @@ int main( int argc, char **argv) /* print initial message to both stderr & stdout */ argv0 = argv[0] ; + memset((void *)lkfile, 0, sizeof(lkfile)); /* random effects on sparc linux */ verb[1] = "ewia" ; msg ( "I " Version " " Copyright ) ; argv0 = efaxbasename ( argv0 ) ; diff --git a/efaxos.c b/efaxos.c index 6b346d6..dc3ae33 100644 --- a/efaxos.c +++ b/efaxos.c @@ -482,7 +482,7 @@ int lockall ( char **lkfiles, int log ) { int err = 0 ; char **p = lkfiles ; - while ( *p && ! err ) + while ( *p && **p && ! err ) if ( ( err = ttlock ( *p++, log ) ) == 3 ) err = 0 ; return err ; } @@ -495,7 +495,7 @@ int unlockall ( char **lkfiles ) { int err = 0, i ; char **p = lkfiles ; - while ( *p ) + while ( *p && **p ) if ( ( i = ttunlock ( *p++ ) ) != 0 ) err = i ; return err ; }