From d2021de5cf94d7a55181004beee296b310901718 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 19 Mar 2007 08:39:32 -0400 Subject: [PATCH] [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 --- lib/ss/ChangeLog | 5 +++++ lib/ss/help.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) 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 + + * 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 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; } -- 2.11.0