mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
Avoid passing NULL argument to memcpy
This commit is contained in:
parent
f0667d239a
commit
60a7720a24
1 changed files with 2 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue