isc-dhcpd: quote filenames for safety
authorPhilip Prindeville <[email protected]>
Sat, 9 Aug 2025 03:48:06 +0000 (21:48 -0600)
committerPhilip Prindeville <[email protected]>
Fri, 15 Aug 2025 03:43:00 +0000 (21:43 -0600)
Per best practices, we should protect against wildcards in
variable expansions.

Signed-off-by: Philip Prindeville <[email protected]>
net/isc-dhcp/files/dhcpd.init

index 7f32e41f4ceec77cbd8982108d6ffce1b3d30e5b..66b76061755b042d173a7bed4802fccbca0374fd 100755 (executable)
@@ -638,7 +638,7 @@ start_service() {
        else
                . /lib/functions/network.sh
 
-               local dyn_file=$(mktemp -u /tmp/dhcpd.XXXXXX)
+               local dyn_file="$(mktemp -u /tmp/dhcpd.XXXXXX)"
 
                config_load dhcp
 
@@ -653,7 +653,7 @@ start_service() {
                general_config > $config_file
 
                if [ $dynamicdns -eq 1 ]; then
-                       cat <<EOF > $dyn_file
+                       cat <<EOF > "$dyn_file"
 ; Generated by /etc/init.d/dhcpd at $(date)
 
 ttl $TTL
@@ -681,11 +681,11 @@ EOF
 
                        no_ipv6 && args="-4"
 
-                       nsupdate -l -v $args $dyn_file
+                       nsupdate -l -v $args "$dyn_file"
 
                fi
 
-               rm -f $dyn_file
+               rm -f "$dyn_file"
 
                [ -z "$dhcp_ifs" ] && return 0
        fi