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:
@@ -276,7 +276,7 @@ append_string (struct snprintf_state *state,
|
|||||||
len += pad(state, width, ' ');
|
len += pad(state, width, ' ');
|
||||||
|
|
||||||
if (prec != -1) {
|
if (prec != -1) {
|
||||||
while (*arg && prec--) {
|
while (prec== && *arg) {
|
||||||
(*state->append_char) (state, *arg++);
|
(*state->append_char) (state, *arg++);
|
||||||
++len;
|
++len;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user