From 3b6d7a28ea0b053f27cb169ac31259e20ef4ece0 Mon Sep 17 00:00:00 2001 From: Hugh Waite Date: Wed, 9 Dec 2015 14:15:47 +0000 Subject: [PATCH] utils: Fix crash in http_query - Fixes incorrect fixup logic for http_query_post_hdr - Bug reported by jayesh1017 --- modules/utils/utils.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/modules/utils/utils.c b/modules/utils/utils.c index 368f5b9c95f..b407742ccd0 100644 --- a/modules/utils/utils.c +++ b/modules/utils/utils.c @@ -361,8 +361,7 @@ static int fixup_http_query_get(void** param, int param_no) static int fixup_free_http_query_get(void** param, int param_no) { if (param_no == 1) { - LM_WARN("free function has not been defined for spve\n"); - return 0; + return fixup_free_spve_null(param, 1); } if (param_no == 2) { @@ -406,7 +405,7 @@ static int fixup_http_query_post(void** param, int param_no) */ static int fixup_http_query_post_hdr(void** param, int param_no) { - if ((param_no >= 1) || (param_no <= 3)) { + if ((param_no >= 1) && (param_no <= 3)) { return fixup_spve_null(param, 1); } @@ -432,8 +431,7 @@ static int fixup_http_query_post_hdr(void** param, int param_no) static int fixup_free_http_query_post(void** param, int param_no) { if ((param_no == 1) || (param_no == 2)) { - LM_WARN("free function has not been defined for spve\n"); - return 0; + return fixup_free_spve_null(param, 1); } if (param_no == 3) { @@ -449,12 +447,11 @@ static int fixup_free_http_query_post(void** param, int param_no) */ static int fixup_free_http_query_post_hdr(void** param, int param_no) { - if ((param_no >= 1) || (param_no <= 2)) { - LM_WARN("free function has not been defined for spve\n"); - return 0; + if ((param_no >= 1) && (param_no <= 3)) { + return fixup_free_spve_null(param, 1); } - if (param_no == 3) { + if (param_no == 4) { return fixup_free_pvar_null(param, 1); }