Line 0
Link Here
|
|
|
1 |
--- src/wps/ndef.c.orig 2015-03-15 17:30:39 UTC |
2 |
+++ src/wps/ndef.c |
3 |
@@ -48,6 +48,8 @@ static int ndef_parse_record(const u8 *d |
4 |
if (size < 6) |
5 |
return -1; |
6 |
record->payload_length = ntohl(*(u32 *)pos); |
7 |
+ if (record->payload_length > size - 6) |
8 |
+ return -1; |
9 |
pos += sizeof(u32); |
10 |
} |
11 |
|
12 |
@@ -68,7 +70,8 @@ static int ndef_parse_record(const u8 *d |
13 |
pos += record->payload_length; |
14 |
|
15 |
record->total_length = pos - data; |
16 |
- if (record->total_length > size) |
17 |
+ if (record->total_length > size || |
18 |
+ record->total_length < record->payload_length) |
19 |
return -1; |
20 |
return 0; |
21 |
} |