diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2024-04-28 06:37:24 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2024-05-03 00:26:26 +0000 |
commit | d9ec850bde3c8695bebfdfeea72deb1d060cd183 (patch) | |
tree | 9bfd3b508fde687ad7dc610ab10d34efcafc4380 | |
parent | cf2750be9e3234f7fd8b1534118a562e4128d222 (diff) | |
download | src-d9ec850bde3c8695bebfdfeea72deb1d060cd183.tar.gz src-d9ec850bde3c8695bebfdfeea72deb1d060cd183.zip |
rtld snprintf: do not erronously skip a char at the buffer boundary
(cherry picked from commit 56ee5fc43c40479e2651b21862e299bcf73017ae)
-rw-r--r-- | libexec/rtld-elf/rtld_printf.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libexec/rtld-elf/rtld_printf.c b/libexec/rtld-elf/rtld_printf.c index 07598c73c6d4..befac1c547b7 100644 --- a/libexec/rtld-elf/rtld_printf.c +++ b/libexec/rtld-elf/rtld_printf.c @@ -81,11 +81,10 @@ snprintf_func(int ch, struct snprintf_arg *const info) } break; case PRINT_METHOD_WRITE: - if (info->remain > 0) { - *info->str++ = ch; - info->remain--; - } else + if (info->remain == 0) printf_out(info); + *info->str++ = ch; + info->remain--; break; } } |