summaryrefslogtreecommitdiff
path: root/test/locale-mbwc/dat_wcwidth.c
diff options
context:
space:
mode:
authorJones Desougi <jones.desougi@27m.se>2010-06-10 15:04:51 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2011-02-09 20:17:28 +0100
commit9a9a6365d5c5abb0fe3ec6cc09542e9c7e1d3bec (patch)
tree973272267e7ab2571a773c8563331a162bc9b30c /test/locale-mbwc/dat_wcwidth.c
parent6f810c757e5b14a97f05652972e91f95e321a404 (diff)
*printf: Violation of precision with null string
When a string format is processed and the argument is NULL, this yields "(null)" regardless of precision. This does not make sense, precision should not be exceeded. A simple test shows that glibc outputs nothing if precision is smaller than six and the attached patch implements this same behaviour. Consider the not uncommon case of strings implemented like this: struct string { int len; char *ptr; }; There is often no nultermination and they may be printed like this: printf("%.*s", string.len, string.ptr); If len is 0 then ptr may be anything, but NULL is a common value. Obviously the empty string would be expected, not "(null)". Signed-off-by: Jones Desougi <jones.desougi@27m.se> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'test/locale-mbwc/dat_wcwidth.c')
0 files changed, 0 insertions, 0 deletions