summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/rpc_parse/parse_misc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index f030e266df..838006ab58 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -762,6 +762,11 @@ void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len)
/* set up string lengths. */
SMB_ASSERT(max_len >= str_len);
+ /* Ensure buf is valid if str_len was set. Coverity check. */
+ if (str_len && !buf) {
+ return;
+ }
+
str->str_max_len = max_len;
str->offset = 0;
str->str_str_len = str_len;