summaryrefslogtreecommitdiff
path: root/sys/arch/mips64
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2020-10-21 15:50:01 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2020-10-21 15:50:01 +0000
commitc91d4c3a1a3c2245a7a178cfa77d050dffe91ace (patch)
tree64b83dde2b680559f976a92b75ea45040013cce4 /sys/arch/mips64
parent7429eb090fc34350cc22500a6d9605c96f6f577e (diff)
mips64 has same bug as arm64: copyout(9), copyinstr(9) and
copyoutstr(9) should bail out properly if they are called with a length of 0. ok visa
Diffstat (limited to 'sys/arch/mips64')
-rw-r--r--sys/arch/mips64/mips64/lcore_access.S6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/arch/mips64/mips64/lcore_access.S b/sys/arch/mips64/mips64/lcore_access.S
index 7719053fbc2..c8f941e2d8d 100644
--- a/sys/arch/mips64/mips64/lcore_access.S
+++ b/sys/arch/mips64/mips64/lcore_access.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: lcore_access.S,v 1.29 2020/10/20 15:26:59 visa Exp $ */
+/* $OpenBSD: lcore_access.S,v 1.30 2020/10/21 15:50:00 deraadt Exp $ */
/*
* Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -106,7 +106,8 @@ sigfillsiz:
* u_long *lencopied;
*/
LEAF(copystr, 0)
- move t2, a2 # Save the number of bytes
+ beq a2, zero, 9f
+ move t2, a2 # Save the number of bytes
move v0, zero
1:
lbu t0, 0(a0)
@@ -117,6 +118,7 @@ LEAF(copystr, 0)
PTR_ADDU a1, a1, 1
bne a2, zero, 1b
NOP
+9:
LI v0, ENAMETOOLONG # String is longer than maxlength
2:
beq a3, zero, 3f