From f99b123aa5398e4505e50049e0fe02e08c6dff1c Mon Sep 17 00:00:00 2001 From: Nikolai Ruhe Date: Fri, 25 Jan 2019 17:01:35 +0100 Subject: [PATCH] Fix buffer reallocation size in `netbios_session_packet_append`. This fixes a crash in `smb_fwrite` under iOS. --- src/netbios_session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/netbios_session.c b/src/netbios_session.c index 25925b2..a56c0cc 100644 --- a/src/netbios_session.c +++ b/src/netbios_session.c @@ -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;