summaryrefslogtreecommitdiffstats
path: root/wsutil/to_str.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 17:44:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 17:44:18 +0000
commit1da76b3706a6c9bd41bf8f219d7c97de5e1e5c7f (patch)
tree9930fb4bb87cd6037f60efff9656f967121c8c2d /wsutil/to_str.c
parentAdding debian version 4.2.2-1.1. (diff)
downloadwireshark-1da76b3706a6c9bd41bf8f219d7c97de5e1e5c7f.tar.xz
wireshark-1da76b3706a6c9bd41bf8f219d7c97de5e1e5c7f.zip
Merging upstream version 4.2.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--wsutil/to_str.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/wsutil/to_str.c b/wsutil/to_str.c
index d15576d4..d3e41538 100644
--- a/wsutil/to_str.c
+++ b/wsutil/to_str.c
@@ -225,7 +225,10 @@ bytes_to_str_punct_maxlen(wmem_allocator_t *scope,
int truncated = 0;
ws_return_str_if(!src, scope);
- ws_return_str_if(!src_size, scope);
+
+ if (!src_size) {
+ return wmem_strdup(scope, "");
+ }
if (!punct)
return bytes_to_str_maxlen(scope, src, src_size, max_bytes_len);
@@ -264,7 +267,10 @@ bytes_to_str_maxlen(wmem_allocator_t *scope,
int truncated = 0;
ws_return_str_if(!src, scope);
- ws_return_str_if(!src_size, scope);
+
+ if (!src_size) {
+ return wmem_strdup(scope, "");
+ }
if (max_bytes_len == 0 || max_bytes_len > src_size) {
max_bytes_len = src_size;