fix confstr return value
authorTimo Teräs <timo.teras@iki.fi>
Wed, 19 Feb 2014 07:40:35 +0000 (09:40 +0200)
committerRich Felker <dalias@aerifal.cx>
Mon, 24 Mar 2014 21:33:54 +0000 (17:33 -0400)
per the specification, the terminating null byte is counted.

src/conf/confstr.c

index 4332f72..6e9c23a 100644 (file)
@@ -13,5 +13,5 @@ size_t confstr(int name, char *buf, size_t len)
        }
        // snprintf is overkill but avoid wasting code size to implement
        // this completely useless function and its truncation semantics
-       return snprintf(buf, len, "%s", s);
+       return snprintf(buf, len, "%s", s) + 1;
 }