Skip to content

Commit

Permalink
Fix buffer reallocation size in netbios_session_packet_append.
Browse files Browse the repository at this point in the history
This fixes a crash in `smb_fwrite` under iOS.
  • Loading branch information
NikolaiRuhe authored and tguillem committed Mar 1, 2022
1 parent 32e8f95 commit f99b123
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/netbios_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ int netbios_session_packet_append(netbios_session *s,
assert(s && s->packet);

if (s->packet_payload_size - s->packet_cursor < size)
if (!session_buffer_realloc(s, size + s->packet_cursor))
if (!session_buffer_realloc(s, size + s->packet_cursor + sizeof(netbios_session_packet)))
return 0;

start = ((char *)&s->packet->payload) + s->packet_cursor;
Expand Down

0 comments on commit f99b123

Please sign in to comment.