Репозитории ALT
S: | 1.3.59-alt4 |
5.1: | 1.3.29-alt2 |
4.1: | 1.3.29-alt2 |
4.0: | 1.3.29-alt2 |
3.0: | 1.2.24-alt5 |
+backports: | 1.3.29-alt0.M30.1 |
Группа :: Система/Настройка/Загрузка и инициализация
Пакет: chkconfig
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: chkconfig-1.2.24-alt-isreg.patch
Скачать
Скачать
diff -uprk.orig chkconfig-1.2.24.orig/chkconfig.c chkconfig-1.2.24/chkconfig.c
--- chkconfig-1.2.24.orig/chkconfig.c 2003-10-29 14:34:08 +0300
+++ chkconfig-1.2.24/chkconfig.c 2003-10-29 14:39:52 +0300
@@ -217,7 +217,7 @@ static int listService(char * item) {
err = errno;
continue;
}
- if (!S_ISREG(sb.st_mode)) continue;
+ if (!S_ISREG(sb.st_mode) || !(sb.st_mode & S_IXUSR)) continue;
if (showServiceInfo(ent->d_name, 1)) {
closedir(dir);
diff -uprk.orig chkconfig-1.2.24.orig/leveldb.c chkconfig-1.2.24/leveldb.c
--- chkconfig-1.2.24.orig/leveldb.c 2003-10-29 14:34:08 +0300
+++ chkconfig-1.2.24/leveldb.c 2003-10-29 15:06:18 +0300
@@ -145,7 +145,12 @@ int readXinetdServiceInfo(char *name, st
snprintf(filename, strlen(name)+strlen(XINETDDIR)+50, XINETDDIR "/%s", name);
if ((fd = open(filename, O_RDONLY)) < 0) return -1;
- fstat(fd,&sb);
+ if (fstat (fd, &sb) < 0 || !S_ISREG(sb.st_mode)) {
+ close(fd);
+ errno = EINVAL;
+ return -1;
+ }
+
buf = malloc(sb.st_size+1);
if (read(fd,buf,sb.st_size)!=sb.st_size) {
close(fd);
@@ -231,7 +236,12 @@ int readServiceInfo(char * name, struct
if ((fd = open(filename, O_RDONLY)) < 0) {
return readXinetdServiceInfo(name,service,honorHide);
}
- fstat(fd, &sb);
+
+ if (fstat (fd, &sb) < 0 || !S_ISREG(sb.st_mode) || !(sb.st_mode & S_IXUSR)) {
+ close(fd);
+ errno = EINVAL;
+ return -1;
+ }
bufstart = mmap(NULL, 1 + sb.st_size, PROT_READ, MAP_SHARED, fd, 0);
if (bufstart == ((caddr_t) -1)) {
@@ -241,6 +251,7 @@ int readServiceInfo(char * name, struct
tmpbufstart = (char*)malloc(sb.st_size+1);
if (tmpbufstart == NULL) {
+ munmap(bufstart, sb.st_size);
close(fd);
return -1;
}
@@ -424,7 +435,11 @@ int setXinetdService(struct service s, i
if ( (oldfd = open(oldfname,O_RDONLY)) == -1 ) {
return -1;
}
- fstat(oldfd,&sb);
+ if (fstat (oldfd, &sb) < 0 || !S_ISREG(sb.st_mode)) {
+ close(oldfd);
+ errno = EINVAL;
+ return -1;
+ }
buf = malloc(sb.st_size+1);
if (read(oldfd,buf,sb.st_size)!=sb.st_size) {
close(oldfd);
diff -uprk.orig chkconfig-1.2.24.orig/ntsysv.c chkconfig-1.2.24/ntsysv.c
--- chkconfig-1.2.24/ntsysv.c.orig 2003-10-31 17:23:57 +0300
+++ chkconfig-1.2.24/ntsysv.c 2003-10-31 17:26:41 +0300
@@ -162,7 +162,7 @@ static int getServices(struct service **
err = errno;
continue;
}
- if (!S_ISREG(sb.st_mode)) continue;
+ if (!S_ISREG(sb.st_mode) || !(sb.st_mode & S_IXUSR)) continue;
if (numServices == numServicesAlloced) {
numServicesAlloced += 10;