Browse Source

Michael Bruck: 64 bit va_list fix for crash

git-svn-id: svn://svn.berlios.de/openocd/trunk@451 b42882b7-edfa-0310-969c-e2dbd0fdcd60
tags/v0.1.0
oharboe 16 years ago
parent
commit
c6c6cd0ffd
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      src/helper/log.c

+ 5
- 2
src/helper/log.c View File

@@ -284,9 +284,12 @@ char *alloc_printf(const char *fmt, va_list ap)
free(t);
return NULL;
}

va_list ap_copy;
va_copy(ap_copy, ap);

int ret;
ret = vsnprintf(string, size, fmt, ap);
ret = vsnprintf(string, size, fmt, ap_copy);
/* NB! The result of the vsnprintf() might be an *EMPTY* string! */
if ((ret >= 0) && ((ret + 1) < size))
break;


Loading…
Cancel
Save