diff options
-rw-r--r-- | src/util/blob.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/blob.c b/src/util/blob.c index 94d5a9dea74..e4000334e0a 100644 --- a/src/util/blob.c +++ b/src/util/blob.c @@ -162,7 +162,7 @@ blob_write_bytes(struct blob *blob, const void *bytes, size_t to_write) VG(VALGRIND_CHECK_MEM_IS_DEFINED(bytes, to_write)); - if (blob->data) + if (blob->data && to_write > 0) memcpy(blob->data + blob->size, bytes, to_write); blob->size += to_write; @@ -286,7 +286,7 @@ blob_copy_bytes(struct blob_reader *blob, void *dest, size_t size) const void *bytes; bytes = blob_read_bytes(blob, size); - if (bytes == NULL) + if (bytes == NULL || size == 0) return; memcpy(dest, bytes, size); |