From: Victor Julien Date: Mon, 28 Nov 2016 08:59:05 +0000 (+0100) Subject: content: fix -Wshadow warning X-Git-Tag: suricata-3.2~38 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d50b4b84711daf23a2e5c3ea650368677edc4123;p=thirdparty%2Fsuricata.git content: fix -Wshadow warning --- diff --git a/src/detect-content.c b/src/detect-content.c index a62b4e274b..9b990a9405 100644 --- a/src/detect-content.c +++ b/src/detect-content.c @@ -291,8 +291,7 @@ void DetectContentPrint(DetectContentData *cd) SCLogDebug("DetectContentData \"cd\" is NULL"); return; } - char *tmpstr=SCMalloc(sizeof(char) * cd->content_len + 1); - + char *tmpstr = SCMalloc(sizeof(char) * cd->content_len + 1); if (tmpstr != NULL) { for (i = 0; i < cd->content_len; i++) { if (isprint(cd->content[i])) @@ -318,19 +317,20 @@ void DetectContentPrint(DetectContentData *cd) SCLogDebug("flags: %u ", cd->flags); SCLogDebug("negated: %s ", cd->flags & DETECT_CONTENT_NEGATED ? "true" : "false"); SCLogDebug("relative match next: %s ", cd->flags & DETECT_CONTENT_RELATIVE_NEXT ? "true" : "false"); + if (cd->replace && cd->replace_len) { - char *tmpstr=SCMalloc(sizeof(char) * cd->replace_len + 1); + char *tmprstr = SCMalloc(sizeof(char) * cd->replace_len + 1); - if (tmpstr != NULL) { + if (tmprstr != NULL) { for (i = 0; i < cd->replace_len; i++) { if (isprint(cd->replace[i])) - tmpstr[i] = cd->replace[i]; + tmprstr[i] = cd->replace[i]; else - tmpstr[i] = '.'; + tmprstr[i] = '.'; } - tmpstr[i] = '\0'; - SCLogDebug("Replace: \"%s\"", tmpstr); - SCFree(tmpstr); + tmprstr[i] = '\0'; + SCLogDebug("Replace: \"%s\"", tmprstr); + SCFree(tmprstr); } else { SCLogDebug("Replace: "); for (i = 0; i < cd->replace_len; i++)