mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-01-22 15:51:05 -05:00
modify call of stat to use NUL delimiter
for more robust string parsing
This commit is contained in:
parent
d536683511
commit
00911df5c1
@ -72,7 +72,7 @@ add_nosuid_statoverride_entry() {
|
|||||||
while IFS="" read -r -d "" line; do
|
while IFS="" read -r -d "" line; do
|
||||||
counter_actual="$((counter_actual + 1))"
|
counter_actual="$((counter_actual + 1))"
|
||||||
|
|
||||||
local arr file_name existing_mode existing_owner existing_group stat_output
|
local arr file_name file_name_from_stat existing_mode existing_owner existing_group stat_output
|
||||||
|
|
||||||
file_name="${line}"
|
file_name="${line}"
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ add_nosuid_statoverride_entry() {
|
|||||||
readarray -d '\0' -t arr <<< "${stat_output}"
|
readarray -d '\0' -t arr <<< "${stat_output}"
|
||||||
|
|
||||||
if test "${#arr[@]}" = 0; then
|
if test "${#arr[@]}" = 0; then
|
||||||
log error "Line is empty: '${line}'" >&2
|
log error "Line is empty. Stat output: '${stat_output}', line: '${line}'" >&2
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -387,12 +387,19 @@ set_file_perms() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local arr file_name existing_mode existing_owner existing_group
|
local arr file_name file_name_from_stat existing_mode existing_owner existing_group
|
||||||
read -r -a arr <<< "${stat_output}"
|
readarray -d '\0' -t arr <<< "${stat_output}"
|
||||||
file_name="${fso_without_trailing_slash}"
|
file_name="${fso_without_trailing_slash}"
|
||||||
existing_mode="${arr[0]}"
|
|
||||||
existing_owner="${arr[1]}"
|
if test "${#arr[@]}" = 0; then
|
||||||
existing_group="${arr[2]}"
|
log error "Line is empty: '${line}'" >&2
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
file_name_from_stat="${arr[0]}"
|
||||||
|
existing_mode="${arr[1]}"
|
||||||
|
existing_owner="${arr[2]}"
|
||||||
|
existing_group="${arr[3]}"
|
||||||
|
|
||||||
if test "${#arr[@]}" = 0; then
|
if test "${#arr[@]}" = 0; then
|
||||||
log error "Line is empty. Stat output: '${stat_output}', line: '${line}'" >&2
|
log error "Line is empty. Stat output: '${stat_output}', line: '${line}'" >&2
|
||||||
|
Loading…
Reference in New Issue
Block a user