[PATCH f15-branch master] Fixup rindex usage (#678086)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



rindex can return a NULL and the strcmp needs to check for .iso
otherwise any file without .iso would cause a segfault
---
 loader/hdinstall.c  |    2 +-
 loader/nfsinstall.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/loader/hdinstall.c b/loader/hdinstall.c
index c321afb..8f56f98 100644
--- a/loader/hdinstall.c
+++ b/loader/hdinstall.c
@@ -93,7 +93,7 @@ static int ends_with_iso(char *dirname, struct dirent *ent) {
         return 0;
 
     suffix = rindex(ent->d_name, '.');
-    return (!strcmp(suffix, "iso"));
+    return (suffix && !strcmp(suffix, ".iso"));
 }
 
 int loadHdImages(struct loaderData_s *loaderData) {
diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c
index 45260c2..3abdbc0 100644
--- a/loader/nfsinstall.c
+++ b/loader/nfsinstall.c
@@ -178,7 +178,7 @@ static int ends_with_iso(char *dirname, struct dirent *ent) {
         return 0;
 
     suffix = rindex(ent->d_name, '.');
-    return (!strcmp(suffix, ".iso"));
+    return (suffix && !strcmp(suffix, ".iso"));
 }
 
 static unsigned int isNfsIso(struct loaderData_s *loaderData) {
-- 
1.7.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux