diff --git a/src/reversing/bh_zerostring.sh b/src/reversing/bh_zerostring.sh index 9bfe68b..3b8d945 100644 --- a/src/reversing/bh_zerostring.sh +++ b/src/reversing/bh_zerostring.sh @@ -4,13 +4,12 @@ bh_zerostring() { local fil="$1" local search="$2" - # 'tr' is needed here because strings command outputs lines - # starting with two space characters in some systems - local pos=$(strings -t d "$fil" | grep -F "$search" | tr -s ' ' ' ' | cut -d' ' -f2) + # 'tr' is needed here because the strings command + # might output lines starting with two spaces + local pos=$(strings -t d "$fil" | grep -F "$search" | tr -s ' ' ' ' | cut -d' ' -f1) - siz=${#search} + local siz=${#search} for i in $pos; do - [[ $i -gt 0 ]] || continue dd conv=notrunc bs=1 count=$siz seek=$i if=/dev/zero of="$fil" done }