Skip to content

Commit

Permalink
Merge pull request #3480 from ar45/fix-maxfwds
Browse files Browse the repository at this point in the history
[maxfwd]: Fix bug `is_maxfwd_lt` function limit value
  • Loading branch information
bogdan-iancu authored Dec 16, 2024
2 parents 4b67742 + e77555d commit e6a0c98
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions modules/maxfwd/maxfwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static int max_limit = MAXFWD_UPPER_LIMIT;

static int fixup_maxfwd_header(void** param);
static int w_process_maxfwd_header(struct sip_msg* msg, int* mval);
static int is_maxfwd_lt(struct sip_msg *msg, char *slimit, char *foo);
static int is_maxfwd_lt(struct sip_msg *msg, int *limit);
static int mod_init(void);


Expand Down Expand Up @@ -169,21 +169,19 @@ static int w_process_maxfwd_header(struct sip_msg* msg, int* mval)



static int is_maxfwd_lt(struct sip_msg *msg, char *slimit, char *foo)
static int is_maxfwd_lt(struct sip_msg *msg, int *limit)
{
str mf_value;
int limit;
int val;

limit = (int)(long)slimit;
val = is_maxfwd_present( msg, &mf_value);
LM_DBG("value = %d \n",val);
LM_DBG("value = %d, limit = %d\n", val, *limit);

if ( val<0 ) {
/* error or not found */
/* coverity[return_overflow: FALSE] */
return val-1;
} else if ( val>=limit ) {
} else if ( val >= *limit ) {
/* greater or equal than/to limit */
return -1;
}
Expand Down

0 comments on commit e6a0c98

Please sign in to comment.