0001-checksec-Fixed-issue-with-relative-path.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From b48a2dfae26fa3b4af8e65fb5953b3caf62c137b Mon Sep 17 00:00:00 2001
  2. From: Paresh Chaudhary <paresh.chaudhary@rockwellcollins.com>
  3. Date: Mon, 21 May 2018 14:34:23 -0500
  4. Subject: [PATCH] checksec: Fixed issue with relative path
  5. Before this patch, the checksec script was not able to find existing
  6. directories when the user passed a relative path with --dir/-d,
  7. the script aborted with a "No such file or directory". The same error
  8. was reported when the script was executed through a relative path.
  9. https://github.com/slimm609/checksec.sh/issues/54
  10. Signed-off-by: Paresh Chaudhary <paresh.chaudhary@rockwellcollins.com>
  11. Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
  12. ---
  13. checksec | 4 ++--
  14. 1 file changed, 2 insertions(+), 2 deletions(-)
  15. diff --git a/checksec b/checksec
  16. index 24b521f..baf8d63 100755
  17. --- a/checksec
  18. +++ b/checksec
  19. @@ -1193,7 +1193,7 @@ do
  20. echo_message "RELRO STACK CANARY NX PIE RPATH RUNPATH FORTIFY Checked Total Filename\n" '' "<dir name='$tempdir'>\n" "{ \"dir\": { \"name\":\"$tempdir\" },"
  21. fdircount=0
  22. fdirtotal=0
  23. - for N in $(find $tempdir -type f); do
  24. + for N in $(find . -type f); do
  25. if [[ "$N" != "[A-Za-z1-0]*" ]]; then
  26. out=$(file "$N")
  27. if [[ $out =~ ELF ]] ; then
  28. @@ -1201,7 +1201,7 @@ do
  29. fi
  30. fi
  31. done
  32. - for N in $(find $tempdir -type f); do
  33. + for N in $(find . -type f); do
  34. if [[ "$N" != "[A-Za-z1-0]*" ]]; then
  35. # read permissions?
  36. if [[ ! -r "$N" ]]; then
  37. --
  38. 1.9.1