Skip to content

Commit 21323a2

Browse files
committed
Fix integer overflow in URI parsing
If an ID exeeds the max. possible value we return early with an error instead of continuing and checking for too big values at the end.
1 parent f20058f commit 21323a2

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

core/uri.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ static int prv_parseNumber(uint8_t * uriString,
7171
{
7272
result *= 10;
7373
result += uriString[*headP] - '0';
74+
if (result > LWM2M_MAX_ID) {
75+
return -1;
76+
}
7477
}
7578
else
7679
{
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
</37777777777>/>/

0 commit comments

Comments
 (0)