>From coverity scan vhostmd-1.1/vhostmd/util.c:421: returned_null: "strstr" returns "NULL" (checked 6 out of 7 times). Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx> --- vhostmd/util.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vhostmd/util.c b/vhostmd/util.c index 599c5c7..317dbc6 100644 --- a/vhostmd/util.c +++ b/vhostmd/util.c @@ -422,10 +422,12 @@ char *vu_str_replace(const char *haystack, const char *origstr, const char *news cp = tempstr; for (i=0; i <cnt; i++) { p = strstr(cp, origstr); - *p = '\0'; - strcat(dest, cp); - strcat(dest, newstr); - cp = p + origlen; + if (p) { + *p = '\0'; + strcat(dest, cp); + strcat(dest, newstr); + cp = p + origlen; + } } strcat(dest, cp); -- 2.16.4 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list