diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2018-09-24 15:11:14 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2018-09-24 15:11:14 +0200 |
commit | e0e280b7669435b991b7e457abd8aa450930b3e8 (patch) | |
tree | 3e6084f13b14ad2df104e2ce6e589eb96c5f7ac9 /src/libstrongswan/bio | |
parent | 51a71ee15c1bcf0e82f363a16898f571e211f9c3 (diff) | |
download | vyos-strongswan-e0e280b7669435b991b7e457abd8aa450930b3e8.tar.gz vyos-strongswan-e0e280b7669435b991b7e457abd8aa450930b3e8.zip |
New upstream version 5.7.0
Diffstat (limited to 'src/libstrongswan/bio')
-rw-r--r-- | src/libstrongswan/bio/bio_reader.c | 5 | ||||
-rw-r--r-- | src/libstrongswan/bio/bio_reader.h | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/libstrongswan/bio/bio_reader.c b/src/libstrongswan/bio/bio_reader.c index 82e405002..e6b459bbf 100644 --- a/src/libstrongswan/bio/bio_reader.c +++ b/src/libstrongswan/bio/bio_reader.c @@ -122,13 +122,16 @@ static bool read_uint16_internal(private_bio_reader_t *this, uint16_t *res, static bool read_uint24_internal(private_bio_reader_t *this, uint32_t *res, bool from_end) { + uint32_t tmp; + if (this->buf.len < 3) { DBG1(DBG_LIB, "%d bytes insufficient to parse u_int24 data", this->buf.len); return FALSE; } - *res = untoh32(get_ptr_end(this, 3, from_end)) >> 8; + memcpy(&tmp, get_ptr_end(this, 3, from_end), 3); + *res = ntohl(tmp) >> 8; this->buf = chunk_skip_end(this->buf, 3, from_end); return TRUE; } diff --git a/src/libstrongswan/bio/bio_reader.h b/src/libstrongswan/bio/bio_reader.h index fbca8bdf5..859fa8a73 100644 --- a/src/libstrongswan/bio/bio_reader.h +++ b/src/libstrongswan/bio/bio_reader.h @@ -142,7 +142,7 @@ struct bio_reader_t { * Read a chunk of len bytes from the end of the buffer, reduce remaining. * * @param len number of bytes to read - * @param res ponter to result, not cloned + * @param res pointer to result, not cloned * @return TRUE if data read successfully */ bool (*read_data_end)(bio_reader_t *this, uint32_t len, chunk_t *res); |