mirror of
https://github.com/open5gs/open5gs.git
synced 2026-10-19 09:44:04 +00:00
OSS-Fuzz: Fix gtp-message-fuzz to accommodate both v1 and v2
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
This commit is contained in:
parent
8d7dc80079
commit
7b7327aa61
2 changed files with 12 additions and 2 deletions
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#define kMinInputLength 5
|
||||
#define kMaxInputLength 1024
|
||||
#define GTP_VERSION(byte) (((byte) >> 5) & 0x07)
|
||||
|
||||
extern int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
||||
{ /* open5gs/tests/non3gpp/gtp-path.c */
|
||||
|
|
@ -47,8 +48,17 @@ extern int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
|||
}
|
||||
ogs_pkbuf_put_data(pkbuf, Data, Size);
|
||||
|
||||
ogs_gtp2_message_t gtp_message;
|
||||
ogs_gtp2_parse_msg(>p_message, pkbuf);
|
||||
if (GTP_VERSION(Data[0]) == OGS_GTP1_VERSION_1) {
|
||||
/* GTPv1 */
|
||||
if (Size >= 8) {
|
||||
ogs_gtp1_message_t gtp1_message;
|
||||
ogs_gtp1_parse_msg(>p1_message, pkbuf);
|
||||
}
|
||||
} else {
|
||||
/* GTPv2 */
|
||||
ogs_gtp2_message_t gtp_message;
|
||||
ogs_gtp2_parse_msg(>p_message, pkbuf);
|
||||
}
|
||||
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue