From aba70a8ca2468741776d28d487f50b40c9941849 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 18 Jan 2008 19:20:54 +0000 Subject: [PATCH] Adjusted the fake goto, so that passing a NULL target buffer together with a 0 size to user_strlcpy() is OK. This way one can use it as a safe strnlen(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23617 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/arch/x86/arch_cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/arch/x86/arch_cpu.c b/src/system/kernel/arch/x86/arch_cpu.c index 44f959e0b4..27d899cc0b 100644 --- a/src/system/kernel/arch/x86/arch_cpu.c +++ b/src/system/kernel/arch/x86/arch_cpu.c @@ -622,7 +622,7 @@ arch_cpu_user_strlcpy(char *to, const char *from, size_t size, addr_t *faultHand addr_t oldFaultHandler = *faultHandler; // this check is to trick the gcc4 compiler and have it keep the error label - if (to == NULL) + if (to == NULL && size > 0) goto error; *faultHandler = (addr_t)&&error;