diff --git a/lib/common.c b/lib/common.c index bc3bf1df..097c0130 100644 --- a/lib/common.c +++ b/lib/common.c @@ -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;