]> git.sur5r.net Git - openocd/commitdiff
Michael Bruck: 64 bit va_list fix for crash
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 6 Mar 2008 12:01:17 +0000 (12:01 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 6 Mar 2008 12:01:17 +0000 (12:01 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@451 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/helper/log.c

index b38987232eb290b06533bf03d367c0eb07a7e6ed..5127a3731ab28fd06f0bb6193a1ad286c98ad5e7 100644 (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;