mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
Avoid passing NULL argument to memcpy
This commit is contained in:
committed by
Rusty Russell
parent
f0667d239a
commit
60a7720a24
@@ -1,5 +1,6 @@
|
||||
#include "pullpush.h"
|
||||
#include "varint.h"
|
||||
#include <assert.h>
|
||||
#include <ccan/endian/endian.h>
|
||||
#include <ccan/mem/mem.h>
|
||||
#include <ccan/tal/tal.h>
|
||||
@@ -58,6 +59,7 @@ const u8 *pull(const u8 **cursor, size_t *max, void *copy, size_t n)
|
||||
}
|
||||
*cursor += n;
|
||||
*max -= n;
|
||||
assert(p);
|
||||
if (copy)
|
||||
memcpy(copy, p, n);
|
||||
return memcheck(p, n);
|
||||
|
||||
Reference in New Issue
Block a user