]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
htp: fix boundry error handling (CID 1153934)
authorVictor Julien <victor@inliniac.net>
Fri, 11 Mar 2016 08:29:20 +0000 (09:29 +0100)
committerVictor Julien <victor@inliniac.net>
Sat, 12 Mar 2016 13:18:18 +0000 (14:18 +0100)
src/app-layer-htp.c

index 384dbeea31b57f1f65aec4c77310f4e3804c67a1..008aeff4c8c3515f6d5ba0c474e63c12c3e97142 100644 (file)
@@ -1090,7 +1090,7 @@ static int HtpRequestBodySetupBoundary(HtpTxUserData *htud,
     uint8_t eb_len = htud->boundary_len + 2;
     eb = (uint8_t *)HTPMalloc(eb_len);
     if (eb == NULL) {
-        goto error;
+        SCReturnInt(-1);
     }
     memset(eb, '-', eb_len);
     memcpy(eb + 2, htud->boundary, htud->boundary_len);
@@ -1098,7 +1098,8 @@ static int HtpRequestBodySetupBoundary(HtpTxUserData *htud,
     uint8_t ebe_len = htud->boundary_len + 4;
     ebe = (uint8_t *)HTPMalloc(ebe_len);
     if (ebe == NULL) {
-        goto error;
+        HTPFree(eb, eb_len);
+        SCReturnInt(-1);
     }
     memset(ebe, '-', ebe_len);
     memcpy(ebe + 2, htud->boundary, htud->boundary_len);
@@ -1109,15 +1110,6 @@ static int HtpRequestBodySetupBoundary(HtpTxUserData *htud,
     *expected_boundary_end_len = ebe_len;
 
     SCReturnInt(0);
-
-error:
-    if (eb != NULL) {
-        HTPFree(eb, eb_len);
-    }
-    if (ebe != NULL) {
-        HTPFree(ebe, ebe_len);
-    }
-    SCReturnInt(-1);
 }
 
 #define C_D_HDR "content-disposition:"