nat: Add extra size check for the number and fail if it does not fit

If the replaced number is too long for the phone number we will
have to stop processing here.
This commit is contained in:
Holger Hans Peter Freyther 2011-02-10 11:41:49 +01:00
parent 6e1a676e21
commit 4446b3bf34
1 changed files with 6 additions and 0 deletions

View File

@ -819,6 +819,12 @@ struct msgb *bsc_nat_rewrite_setup(struct bsc_nat *nat, struct msgb *msg, struct
return msg;
}
if (strlen(new_number) > sizeof(called.number)) {
LOGP(DNAT, LOGL_ERROR, "Number is too long for structure.\n");
talloc_free(new_number);
return msg;
}
/*
* Need to create a new message now based on the old onew
* with a new number. We can sadly not patch this in place