From ec36f09e923f9f4b396a116ddcfc5cd8d6382367 Mon Sep 17 00:00:00 2001 From: Sebastien Blot Date: Fri, 5 Feb 2016 17:43:17 +0100 Subject: handle filenames with spaces --- php-malware-finder/phpmalwarefinder | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/php-malware-finder/phpmalwarefinder b/php-malware-finder/phpmalwarefinder index 49cf8ce..98c578d 100755 --- a/php-malware-finder/phpmalwarefinder +++ b/php-malware-finder/phpmalwarefinder @@ -31,11 +31,11 @@ fi # before starting yara, check if the file one_line_trick() { - for file in $(find $@ -type f); do - line_num=$(wc -l $file | cut -d' ' -f1) - char_num=$(wc -c $file | cut -d' ' -f1) + find $@ -type f -print0 | while IFS= read -r -d '' -r file; do + line_num=$(wc -l "$file" | cut -d' ' -f1) + char_num=$(wc -c "$file" | cut -d' ' -f1) - if [ "$line_num" -le "2" ]; then + if [ "$line_num" -le "2" ]; then # humm, 2 lines long file ? if [ "$char_num" -ge "300" ]; then echo TooShort $file -- cgit v1.3