Skip to content

Commit 25b8729

Browse files
committed
CDRIVER-3725 fix uninitialized read
1 parent 188f5b4 commit 25b8729

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libmongoc/src/mongoc/mongoc-cluster-sspi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,9 @@ _mongoc_cluster_auth_node_sspi (mongoc_cluster_t *cluster,
266266

267267
tmpstr = bson_iter_utf8 (&iter, &buflen);
268268
bson_free (buf);
269-
buf = bson_malloc (sizeof (SEC_CHAR) * buflen);
269+
buf = bson_malloc (sizeof (SEC_CHAR) * (buflen + 1));
270270
memcpy (buf, tmpstr, buflen);
271+
buf[buflen] = (SEC_CHAR) 0;
271272

272273
bson_destroy (&reply);
273274
}

0 commit comments

Comments
 (0)