network

low level network subjects
Log | Files | Refs | Submodules | README | git clone https://git.ne02ptzero.me/git/network

commit b4b45e7fe16c1c0970c7afb07b13f11c36a0b002
parent f2a13846ba5e2d9415a3c8ba2cb763d6d5015680
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Tue, 28 Feb 2017 19:06:19 +0100

Fix(write_string): Now checking if the string is NULL before copy

Diffstat:
Minc/package.h | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/inc/package.h b/inc/package.h @@ -12,8 +12,10 @@ # define write_member(mem, data, count) memcpy(data + count, &mem, sizeof(mem)); \ count += sizeof(mem); -# define write_string(mem, data, len, count) memcpy(data + count, mem, len); \ - count += len; +# define write_string(mem, data, len, count) if (mem != NULL) { \ + memcpy(data + count, mem, len); \ + count += len; \ + } /* Header */ typedef struct package_s {