summaryrefslogtreecommitdiff
path: root/libc/misc
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc')
-rw-r--r--libc/misc/syslog/syslog.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c
index 250cb6ddc..e39e63a05 100644
--- a/libc/misc/syslog/syslog.c
+++ b/libc/misc/syslog/syslog.c
@@ -206,7 +206,15 @@ vsyslog( int pri, const char *fmt, va_list ap )
memmove(head_end + sizeof(truncate_msg), head_end,
end - head_end - sizeof(truncate_msg));
memcpy(head_end, truncate_msg, sizeof(truncate_msg));
- p = end - 1;
+ if (p < head_end) {
+ while (p < end && *p) {
+ p++;
+ }
+ }
+ else {
+ p = end - 1;
+ }
+
}
last_chr = p;