From: miod Date: Fri, 8 Mar 2024 16:18:53 +0000 (+0000) Subject: Make sure copyoutstr() invoked with a length of zero returns ENAMETOOLONG. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0ef4c01d20d2bc6284e9fe597e1ab931390ff0fa;p=openbsd 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. --- 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