summaryrefslogtreecommitdiff
path: root/sys/arch/m88k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2024-03-08 16:18:54 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2024-03-08 16:18:54 +0000
commitb44a8023f1e436455f11e7abdf9f592e5665f1a6 (patch)
treeda70e93e658fe3a92d2c88dfab6adcb9ce60dbf3 /sys/arch/m88k
parentb0c7683bc4710577c0b806489efb89ebcc9ee077 (diff)
Make sure copyoutstr() invoked with a length of zero returns ENAMETOOLONG.
This bug has been present in that file since the very beginning, more than 28 years ago.
Diffstat (limited to 'sys/arch/m88k')
-rw-r--r--sys/arch/m88k/m88k/subr.S9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/arch/m88k/m88k/subr.S b/sys/arch/m88k/m88k/subr.S
index ff73eec1553..b930841170e 100644
--- a/sys/arch/m88k/m88k/subr.S
+++ b/sys/arch/m88k/m88k/subr.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr.S,v 1.31 2023/12/12 07:37:21 deraadt Exp $ */
+/* $OpenBSD: subr.S,v 1.32 2024/03/08 16:18:53 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1992 Carnegie Mellon University
@@ -714,7 +714,7 @@ ENTRY(copyoutstr)
or %r6, %r6, %lo16(Lcosflt)
st %r6, %r7, PCB_ONFAULT
bcnd lt0, CNT, Lcosflt
- bcnd eq0, CNT, Lcosdone
+ bcnd eq0, CNT, 2f
or %r6, %r0, 0
1:
ld.bu %r7, SRC, %r6
@@ -727,13 +727,14 @@ ENTRY(copyoutstr)
#else
st.b.usr %r7, DEST, %r6
#endif
- bcnd.n eq0, %r7, 2f /* all done */
+ bcnd.n eq0, %r7, 3f /* all done */
addu %r6, %r6, 1
cmp %r7, %r6, CNT
bb1 lt, %r7, 1b
+2:
br.n Lcosdone
or %r2, %r0, ENAMETOOLONG
-2:
+3:
br.n Lcosdone
or %r2, %r0, 0