mprintf: allow %.s with data not being zero terminated
authorDaniel Stenberg <daniel@haxx.se>
Sun, 4 May 2014 21:37:24 +0000 (23:37 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 4 May 2014 21:39:52 +0000 (23:39 +0200)
commit812da4190f8ac2f548f3bea09b85164b78d33347
tree05918f43143c365d87ae0d85d41b89096278aba3
parent312f36d453c763d96470d5d4cebd8aae28efe5dc
mprintf: allow %.s with data not being zero terminated

If the precision is indeed shorter than the string, don't strlen() to
find the end because that's not how the precision operator works.

I also added a unit test for curl_msnprintf to make sure this works and
that the fix doesn't a few other basic use cases. I found a POSIX
compliance problem that I marked TODO in the unit test, and I figure we
need to add more tests in the future.

Reported-by: Török Edwin
lib/mprintf.c
tests/data/test1398 [new file with mode: 0644]
tests/unit/Makefile.inc
tests/unit/unit1398.c [new file with mode: 0644]