]> granicus.if.org Git - sudo/commitdiff
Fix typo/thinko in static buffer conversion; use vsnprintf() not snprintf()
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 27 May 2015 22:41:46 +0000 (16:41 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 27 May 2015 22:41:46 +0000 (16:41 -0600)
lib/util/fatal.c

index 66215bb5ab10644a3472c0fa9306f45c753d7ad8..295cfe3c18c75ce47854a50a660d0e2fe369da96 100644 (file)
@@ -157,12 +157,12 @@ warning(int errnum, const char *fmt, va_list ap)
 
                /* Use static buffer if possible, else dynamic. */
                va_copy(ap2, ap);
-               buflen = snprintf(static_buf, sizeof(static_buf), fmt, ap2);
+               buflen = vsnprintf(static_buf, sizeof(static_buf), fmt, ap2);
                va_end(ap2);
                if (buflen >= (int)sizeof(static_buf)) {
                    buf = malloc(++buflen);
                    if (buf != NULL)
-                       (void)snprintf(buf, buflen, fmt, ap);
+                       (void)vsnprintf(buf, buflen, fmt, ap);
                    else
                        buf = static_buf;
                }