X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/4ba76501152d51ccb5647018f3192c6096367d48..c6bf4f310a33a9262d455ea4d3f0630b1255e3fe:/bsd/kern/kern_xxx.c diff --git a/bsd/kern/kern_xxx.c b/bsd/kern/kern_xxx.c index ee65deb6c..a07457cd6 100644 --- a/bsd/kern/kern_xxx.c +++ b/bsd/kern/kern_xxx.c @@ -116,8 +116,11 @@ reboot(struct proc *p, struct reboot_args *uap, __unused int32_t *retval) } if (uap->opt & RB_PANIC && uap->msg != USER_ADDR_NULL) { - if (copyinstr(uap->msg, (void *)message, sizeof(message), (size_t *)&dummy)) { + int copy_error = copyinstr(uap->msg, (void *)message, sizeof(message), (size_t *)&dummy); + if (copy_error != 0 && copy_error != ENAMETOOLONG) { strncpy(message, "user space RB_PANIC message copyin failed", sizeof(message) - 1); + } else { + message[sizeof(message) - 1] = '\0'; } }