From: Brian Behlendorf Date: Mon, 19 Mar 2007 12:39:32 +0000 (-0400) Subject: [COVERITY] Fix bad error checking for NULL parameter in ss library X-Git-Tag: E2FSPROGS-1_40~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2021de5cf94d7a55181004beee296b310901718;p=thirdparty%2Fe2fsprogs.git [COVERITY] Fix bad error checking for NULL parameter in ss library Looks like flawed reasoning. Here if info_dir is NULL then you are guaranteed to blow up since you will dereference it. It seems like the correct thing to do here (what the code author meant to do) was to set *code_ptr = SS_ET_NO_INFO_DIR if info_dir was NULL or if *info_dir was an empty string (aka *info_dir == '\0'). Coverity ID: 8: Forward Null Signed-off-by: Brian Behlendorf --- diff --git a/lib/ss/ChangeLog b/lib/ss/ChangeLog index 906ff4634..1bb4272a4 100644 --- a/lib/ss/ChangeLog +++ b/lib/ss/ChangeLog @@ -1,3 +1,8 @@ +2007-03-19 Theodore Tso + + * help.c (ss_add_info_dir): Fix error checking for NULL parameter + passed via info_dir. + 2006-11-17 Theodore Tso * get_readline.c (DEFAULT_LIBPATH): Add libreadline.so.5 to the diff --git a/lib/ss/help.c b/lib/ss/help.c index 235633f77..c1a167d13 100644 --- a/lib/ss/help.c +++ b/lib/ss/help.c @@ -138,7 +138,7 @@ void ss_add_info_dir(sci_idx, info_dir, code_ptr) register char **dirs; info = ss_info(sci_idx); - if (info_dir == NULL && *info_dir) { + if (info_dir == NULL || *info_dir == '\0') { *code_ptr = SS_ET_NO_INFO_DIR; return; }