add check that snprintf doesn't write the NUL into the last byte when

its a zero length input string


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15030 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-04-30 15:03:57 +00:00
parent 45032b3505
commit f651d08834

View File

@@ -225,6 +225,14 @@ test_null (void)
return snprintf (NULL, 0, "foo") != 3;
}
static int
test_length (void)
{
char ch = 'a';
snprintf (&ch, 0, "foo");
return ch != 'a';
}
int
main (int argc, char **argv)
{
@@ -236,5 +244,6 @@ main (int argc, char **argv)
ret += cmp_with_sprintf_long_long ();
#endif
ret += test_null ();
ret += test_length ();
return ret;
}