Module Name: src Committed By: kre Date: Mon Oct 14 08:13:23 UTC 2024
Modified Files: src/bin/sh: Makefile Log Message: Reject nul characters in shell input. At the request of Thomas Klausner (wiz@) copy an idea from OpenBSD, and have the shell simply reject any (sh) input containing a \0 (nul) character. Previously nul characters were simply ignored (removed from the input before it was examined in any other way). Note this affects data read by the shell itself only, and has no impact on other utilities, including those that are built into the shell (so 'read' can still use -d '' to process output using \0 as the record separator). While I have tested that this works, there are so many places where a nul might appear, that I cannot possibly test them all (or even imagine all the possible places), so if this change causes any problems, let me know (if from a script, send me the script). To undo this change, simply comment out (or delete) the line CPPFLAGS+= -DREJECT_NULS from the Makefile, and build again. Eventually if this causes no problems, that option (conditional compilation) will probably just go away, and this change would be permanent. While the conditional compilation (on or off) persists, the NETBSD_SHELL variable value will contain the word REJECT_NULLS so you can easily verify if you are running a shell with this included or not. No pullups planned. To generate a diff of this commit: cvs rdiff -u -r1.123 -r1.124 src/bin/sh/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/sh/Makefile diff -u src/bin/sh/Makefile:1.123 src/bin/sh/Makefile:1.124 --- src/bin/sh/Makefile:1.123 Thu Oct 19 04:27:24 2023 +++ src/bin/sh/Makefile Mon Oct 14 08:13:23 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.123 2023/10/19 04:27:24 mrg Exp $ +# $NetBSD: Makefile,v 1.124 2024/10/14 08:13:23 kre Exp $ # @(#)Makefile 8.4 (Berkeley) 5/5/95 .include <bsd.own.mk> @@ -25,6 +25,8 @@ SCRIPT_ENV= \ CPPFLAGS+=-DSHELL -I. -I${.CURDIR} -I${NETBSDSRCDIR}/lib/libedit CPPFLAGS+= -DUSE_LRAND48 +CPPFLAGS+= -DREJECT_NULS + #XXX: For testing only. #CPPFLAGS+=-DDEBUG=1 #COPTS+=-g @@ -98,3 +100,5 @@ COPTS.parser.c+= ${${ACTIVE_CC} == "gcc" .include <bsd.prog.mk> .include <bsd.subdir.mk> + +${OBJS}: Makefile