]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
properly check for ansi c99 vsnprint truncation
authornick black <nick.black@sprezzatech.com>
Sat, 7 Jul 2012 15:41:15 +0000 (11:41 -0400)
committernick black <nick.black@sprezzatech.com>
Sat, 7 Jul 2012 15:41:15 +0000 (11:41 -0400)
libblkid/src/probe.c

index ce14526e2869f63d350d39a0eb6dfa49549925ba..33220df507ffad4176aa939deafa52a3a13d704d 100644 (file)
@@ -1219,7 +1219,7 @@ int blkid_probe_vsprintf_value(blkid_probe pr, const char *name,
 
        len = vsnprintf((char *) v->data, sizeof(v->data), fmt, ap);
 
-       if (len <= 0) {
+       if (len <= 0 || len >= sizeof(v->data)) {
                blkid_probe_reset_last_value(pr);
                return -1;
        }