Bug in glibc 2 vsnprintf

Andreas Jaeger aj@arthur.rhein-neckar.de
Thu Aug 20 22:49:00 GMT 1998


>>>>> Ulrich Drepper writes:

 > Andreas Jaeger <aj@arthur.rhein-neckar.de> writes:
>> vsnprintf(s, 10, 12345) returned 5 <- ok
>> vsnprintf(s, 1, 123) returned 3 <- AFAIK not according to the old
>> specification (should be -1)
>> vsnprintf(s, 2, 123) returned -1 <- ok

 > I added
 > 	snprintf (buf, 1, "%d", 123);
 > to the test suite and do not see a problem.  What's a correct test case?
Add
snprintf (buf, 10, "%d", 12345);
directly before
snprintf (buf, 1, "%d", 123);

to get:
snprintf (buf, 10, "%d", 12345);
snprintf (buf, 1, "%d", 123);

In this case the second call returns a 3.

Andreas
-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@alma.student.uni-kl.de



More information about the Libc-hacker mailing list