diff options
author | Brian Behlendorf <behlendorf1@llnl.gov> | 2007-03-19 08:39:32 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2007-03-19 08:39:32 -0400 |
commit | d2021de5cf94d7a55181004beee296b310901718 (patch) | |
tree | f9f83f59ba30189f976c6c722a90fd594da52238 /lib/ss | |
parent | 12f91959993f0d2882592427c94f35f32436e03a (diff) | |
download | e2fsprogs-d2021de5cf94d7a55181004beee296b310901718.tar.gz |
[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 <behlendorf1@llnl.gov>
Diffstat (limited to 'lib/ss')
-rw-r--r-- | lib/ss/ChangeLog | 5 | ||||
-rw-r--r-- | lib/ss/help.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/ss/ChangeLog b/lib/ss/ChangeLog index 906ff463..1bb4272a 100644 --- a/lib/ss/ChangeLog +++ b/lib/ss/ChangeLog @@ -1,3 +1,8 @@ +2007-03-19 Theodore Tso <tytso@mit.edu> + + * help.c (ss_add_info_dir): Fix error checking for NULL parameter + passed via info_dir. + 2006-11-17 Theodore Tso <tytso@mit.edu> * get_readline.c (DEFAULT_LIBPATH): Add libreadline.so.5 to the diff --git a/lib/ss/help.c b/lib/ss/help.c index 235633f7..c1a167d1 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; } |