[PATCH] lib: fwts_release: check *str rather than str

Colin King colin.king at canonical.com
Tue May 7 08:20:12 UTC 2013


From: Colin Ian King <colin.king at canonical.com>

Coverity CID #997338: Dereference before null check (REVERSE_NULL)

Should be checking if *str is not end of string rather than
if str is a valid pointer (typo).

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/src/fwts_release.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/src/fwts_release.c b/src/lib/src/fwts_release.c
index 5c06747..c428856 100644
--- a/src/lib/src/fwts_release.c
+++ b/src/lib/src/fwts_release.c
@@ -38,7 +38,7 @@ static void fwts_release_field_get(char *needle, char *delimiter, char *text, ch
 	while (*str == ' ')
 		str++;
 
-	if (str)
+	if (*str)
 		*field = strdup(str);
 }
 
-- 
1.8.1.2




More information about the fwts-devel mailing list