ws_pipe: provide a null terminated string anyway (CID: 1364684).

Change-Id: I4143b499986cbd31db524db73dde72ddbe26077d
Reviewed-on: https://code.wireshark.org/review/25072
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Dario Lombardo 2017-12-29 20:07:24 +01:00 committed by Michael Mann
parent 9aa42e89c3
commit 098fbc70ee
1 changed files with 3 additions and 1 deletions

View File

@ -23,6 +23,7 @@
#endif
#include <glib.h>
#include <log.h>
#include "wsutil/ws_pipe.h"
@ -106,7 +107,8 @@ ws_read_string_from_pipe(ws_pipe_handle read_pipe, gchar *buffer,
if (buffer_bytes_remaining == 0)
{
/* The string won't fit in the buffer. */
/* XXX - provide an error string */
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Buffer too small (%ld).", buffer_size);
buffer[buffer_size - 1] = '\0';
return FALSE;
}