aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2012-05-11 16:05:55 +0200
committerTobias Brunner <tobias@strongswan.org>2012-06-11 17:09:20 +0200
commite8120632ae302fe1e12eeec9baf1a70d33456ca8 (patch)
treeadc11a977626933d5fb09b81b7dd9459e593dfdd
parent6e6d78a561710938188bafd72ad06eb76b6983ec (diff)
downloadstrongswan-e8120632ae302fe1e12eeec9baf1a70d33456ca8.tar.bz2
strongswan-e8120632ae302fe1e12eeec9baf1a70d33456ca8.tar.xz
Don't use chunk_skip() in asn1_length().
chunk_skip() returns chunk_empty if the length of the chunk is equal to the number of bytes to skip, this is problematic as asn1_length() modifies the original chunk. asn1_parser_t for instance uses the modified chunk to later calculate the length of the resulting ASN.1 object which produces incorrect results if it is based on chunk_empty.
-rw-r--r--src/libstrongswan/asn1/asn1.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstrongswan/asn1/asn1.c b/src/libstrongswan/asn1/asn1.c
index 4cb38d126..8adab8580 100644
--- a/src/libstrongswan/asn1/asn1.c
+++ b/src/libstrongswan/asn1/asn1.c
@@ -228,7 +228,8 @@ size_t asn1_length(chunk_t *blob)
/* read length field, skip tag and length */
n = blob->ptr[1];
- *blob = chunk_skip(*blob, 2);
+ blob->ptr += 2;
+ blob->len -= 2;
if ((n & 0x80) == 0)
{ /* single length octet */