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>
Wed, 16 Apr 2014 06:46:04 +0000 (02:46 -0400)
per the specification, the terminating null byte is counted.

(cherry picked from commit 0a8d98285f46f721dabf38485df916c02d6a4675)

src/conf/confstr.c

index 4332f7262beac7b64b80c9986a355bbe9f9e5c98..6e9c23a0812284088fa4bf54d3036d69b006a0a0 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;
 }