Fix NULL check issues (5 HIGH issues resolved)

Added proper null/empty checks and variable quoting in 3 files:

1. wordpress-cron-manager.sh (2 issues):
   - Added validation for $site_path before use
   - Quoted variable in cron command to prevent word splitting
   - Lines 446-449: Check if path is empty or invalid before processing

2. malware-scanner.sh (1 issue):
   - Added safety check for $SCAN_DIR before suggesting rm -rf command
   - Prevents dangerous rm operations if variable is empty or root
   - Line 1583-1585: Guard against accidental deletions

3. mysql-restore-to-sql.sh (2 issues):
   - Quoted $datadir in echo statements showing manual commands
   - Lines 426, 441, 444, 447: Proper quoting in examples

Impact: Prevents potential issues from empty/undefined variables
This commit is contained in:
cschantz
2026-01-09 00:33:02 -05:00
parent 2ccbdc530b
commit 8f3b764e26
3 changed files with 15 additions and 7 deletions
+3 -1
View File
@@ -1580,7 +1580,9 @@ fi
echo "You can:"
echo " • Review logs: ls $LOG_DIR"
echo " • View summary: cat $SUMMARY_FILE"
echo " • Delete scan directory manually: rm -rf $SCAN_DIR"
if [ -n "$SCAN_DIR" ] && [[ "$SCAN_DIR" != "/" ]]; then
echo " • Delete scan directory manually: rm -rf \"$SCAN_DIR\""
fi
echo ""
echo "Press Ctrl+A then D to detach from this screen session,"
echo "or press Enter to open an interactive shell in this session..."