Fixing logging when stanzas are too big

This commit is contained in:
Rob Hoelz
2011-09-07 20:09:19 -05:00
parent bdd70fcfaf
commit 30d4f2b78d

View File

@@ -250,10 +250,13 @@ void xmpp_log(const xmpp_ctx_t * const ctx,
int oldret, ret;
char smbuf[1024];
char *buf;
va_list copy;
buf = smbuf;
va_copy(copy, ap);
ret = xmpp_vsnprintf(buf, 1023, fmt, ap);
if (ret > 1023) {
va_copy(ap, copy);
buf = (char *)xmpp_alloc(ctx, ret + 1);
if (!buf) {
buf = NULL;