]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-sasl: gssapi-dummy - Make gss_display_name() output buffer content nul-terminated
authorStephan Bosch <stephan.bosch@open-xchange.com>
Mon, 13 Oct 2025 09:58:52 +0000 (11:58 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Mon, 13 Oct 2025 11:04:07 +0000 (11:04 +0000)
This makes it a little more robust and makes Coverity happier.

src/lib-sasl/gssapi-dummy.c

index 75bbbc2d7c286c87ec12615e01ae6ba3246fa7e3..15b2e126ecfb09dd75682e7ce436188a9817edfe 100644 (file)
@@ -441,8 +441,8 @@ gss_display_name(OM_uint32 *minor_status, gss_name_t input_name,
 {
        size_t input_name_len = strlen(input_name->name);
 
-       gss_alloc_buffer(output_name_buffer, input_name_len);
-       memcpy(output_name_buffer->value, input_name->name, input_name_len);
+       gss_alloc_buffer(output_name_buffer, input_name_len + 1);
+       memcpy(output_name_buffer->value, input_name->name, input_name_len + 1);
        output_name_buffer->length = input_name_len;
 
        if (output_name_type != NULL)