bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

snprintf


From: James Morrison
Subject: snprintf
Date: Wed, 28 Nov 2001 18:27:31 -0800 (PST)

 Hello,
        I've noticed that on GNU/Hurd snprintf doesn't work if
the expanded template exceeds the size given.

eg
        char limited[5];
        snprintf(limited,5,"12345");

On GNU/Linux with libio snprintf sets limited to "1234" and returns
5.

This same code on GNU/Hurd with stdio sets limited[0] to '\0'
but does not touch any other characters.  snprintf returns 5
on GNU/Hurd as well.

If the template string is extended the results say the same with the
return value changing appropriatly. snprintf works fine on GNU/Hurd
if the resulting string is less than maxsize passed to snprintf.

=====
James Morrison
   University of Waterloo
   Computer Science - Digital Hardware
   2A co-op
http://hurd.dyndns.org

Anyone refering this as 'Open Source' shall be eaten by a GNU

__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]