Skip to content

Commit

Permalink
PROTON-1574: Fix null pointers passed to memmove
Browse files Browse the repository at this point in the history
Found by ASan sanitizer build
  • Loading branch information
alanconway committed Sep 6, 2017
1 parent eac4e31 commit feafb6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions proton-c/src/core/buffer.c
Expand Up @@ -163,6 +163,7 @@ int pn_buffer_ensure(pn_buffer_t *buf, size_t size)

int pn_buffer_append(pn_buffer_t *buf, const char *bytes, size_t size)
{
if (!size) return 0;
int err = pn_buffer_ensure(buf, size);
if (err) return err;

Expand Down
3 changes: 2 additions & 1 deletion proton-c/src/core/framing.c
Expand Up @@ -94,7 +94,8 @@ size_t pn_write_frame(char *bytes, size_t available, pn_frame_t frame)
bytes[5] = frame.type;
pn_i_write16(&bytes[6], frame.channel);

memmove(bytes + AMQP_HEADER_SIZE, frame.extended, frame.ex_size);
if (frame.extended)
memmove(bytes + AMQP_HEADER_SIZE, frame.extended, frame.ex_size);
memmove(bytes + 4*doff, frame.payload, frame.size);
return size;
} else {
Expand Down

0 comments on commit feafb6c

Please sign in to comment.