Avoid passing NULL argument to memcpy

This commit is contained in:
practicalswift 2018-03-05 17:46:14 +01:00 committed by Rusty Russell
parent f0667d239a
commit 60a7720a24

View file

@ -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);