roken: fix append_string "%.s" non-nul termination

It should be possible to pass a format string of "%.s" to permit
a non-nul terminated string to be used as input.  The test of remaining
precision and the test for NUL needs to be reversed to permit this
behavior to function correctly.

Change-Id: I200f9c2886419dc4c3870f5f44bc10e81245f56c
This commit is contained in:
Jeffrey Altman
2015-05-20 10:27:12 -04:00
parent e51c2126e6
commit 0acef7729f

View File

@@ -276,7 +276,7 @@ append_string (struct snprintf_state *state,
len += pad(state, width, ' ');
if (prec != -1) {
while (*arg && prec--) {
while (prec== && *arg) {
(*state->append_char) (state, *arg++);
++len;
}