projects
/
platform
/
upstream
/
libtasn1.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ae04194
)
check for overflows
author
Nikos Mavrogiannopoulos
<nmav@gnutls.org>
Tue, 13 Mar 2012 18:33:30 +0000
(19:33 +0100)
committer
Nikos Mavrogiannopoulos
<nmav@gnutls.org>
Tue, 13 Mar 2012 18:34:32 +0000
(19:34 +0100)
lib/decoding.c
patch
|
blob
|
history
diff --git
a/lib/decoding.c
b/lib/decoding.c
index
00ae287
..
32888a3
100644
(file)
--- a/
lib/decoding.c
+++ b/
lib/decoding.c
@@
-115,15
+115,17
@@
asn1_get_length_der (const unsigned char *der, int der_len, int *len)
static int
asn1_get_length_der_checked (const unsigned char *der, int der_len, int *len)
{
-int ret;
+int ret
, tot
;
ret = asn1_get_length_der(der, der_len, len);
if (ret < 0)
return ret;
-
- if (ret + *len > der_len)
- return -3;
+ tot = ret + *len;
+
+ if (tot < 0 || tot > der_len)
+ return -3;
+
return ret;
}