Skip to content

Commit

Permalink
Fix _sasl_add_string
Browse files Browse the repository at this point in the history
Issue #587 was not solved correctly.

_sasl_add_string adds zero terminator to the output string.
This cuts log messages after the first '%s' of the format string.
With the fix the function _sasl_log now logs the complete message.

Signed-off-by: Howard Chu <[email protected]>
  • Loading branch information
hyc committed Sep 22, 2021
1 parent 0c67d30 commit 8261180
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ int _sasl_add_string(char **out, size_t *alloclen,
if (add==NULL) add = "(null)";

addlen=strlen(add); /* only compute once */
if (_buf_alloc(out, alloclen, (*outlen)+addlen)!=SASL_OK)
if (_buf_alloc(out, alloclen, (*outlen)+addlen+1)!=SASL_OK)
return SASL_NOMEM;

strncpy(*out + *outlen, add, addlen);
strcpy(*out + *outlen, add);
*outlen += addlen;

return SASL_OK;
Expand Down

0 comments on commit 8261180

Please sign in to comment.