diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-06-07 18:28:42 +0200 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-06-07 18:28:42 +0200 |
commit | 3f811502ea804c4c3e8031d50dc27db210152337 (patch) | |
tree | f0a549b29626778efa029266c555dffab38a9c95 | |
parent | 4e854a117310285060ef496709e965841042b084 (diff) | |
download | gnunet-3f811502ea804c4c3e8031d50dc27db210152337.tar.gz gnunet-3f811502ea804c4c3e8031d50dc27db210152337.zip |
-fix serialization invalid memory access
-rw-r--r-- | src/gnsrecord/gnsrecord_serialization.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gnsrecord/gnsrecord_serialization.c b/src/gnsrecord/gnsrecord_serialization.c index eaa3a9ab2..97c488c2b 100644 --- a/src/gnsrecord/gnsrecord_serialization.c +++ b/src/gnsrecord/gnsrecord_serialization.c | |||
@@ -229,15 +229,15 @@ GNUNET_GNSRECORD_records_deserialize_get_size (size_t len, | |||
229 | off = 0; | 229 | off = 0; |
230 | for (off = 0; (off + sizeof(rec) <= len) && (off + sizeof(rec) >= off);) | 230 | for (off = 0; (off + sizeof(rec) <= len) && (off + sizeof(rec) >= off);) |
231 | { | 231 | { |
232 | GNUNET_memcpy (&rec, | ||
233 | &src[off], | ||
234 | sizeof(rec)); | ||
232 | /* | 235 | /* |
233 | * If we have found a byte string of zeroes, we have reached | 236 | * If we have found a byte string of zeroes, we have reached |
234 | * the padding | 237 | * the padding |
235 | */ | 238 | */ |
236 | if (0 == GNUNET_memcmp (&rec, &rec_zero)) | 239 | if (0 == GNUNET_memcmp (&rec, &rec_zero)) |
237 | break; | 240 | break; |
238 | GNUNET_memcpy (&rec, | ||
239 | &src[off], | ||
240 | sizeof(rec)); | ||
241 | off += sizeof(rec); | 241 | off += sizeof(rec); |
242 | if ((off + ntohs ((uint16_t) rec.data_size) > len) || | 242 | if ((off + ntohs ((uint16_t) rec.data_size) > len) || |
243 | (off + ntohs ((uint16_t) rec.data_size) < off)) | 243 | (off + ntohs ((uint16_t) rec.data_size) < off)) |