diff options
Diffstat (limited to 'source/a/slocate')
-rw-r--r-- | source/a/slocate/slocate.CVE-2007-0277.diff | 42 | ||||
-rwxr-xr-x | source/a/slocate/slocate.SlackBuild | 14 | ||||
-rw-r--r-- | source/a/slocate/slocate.bigfile.diff | 33 |
3 files changed, 84 insertions, 5 deletions
diff --git a/source/a/slocate/slocate.CVE-2007-0277.diff b/source/a/slocate/slocate.CVE-2007-0277.diff new file mode 100644 index 00000000..4f109922 --- /dev/null +++ b/source/a/slocate/slocate.CVE-2007-0277.diff @@ -0,0 +1,42 @@ +--- slocate-3.1.orig/src/utils.c ++++ slocate-3.1/src/utils.c +@@ -524,6 +524,7 @@ + { + struct stat path_stat; + int ret = 0; ++ char *path_copy = NULL; + char *ptr = NULL; + + if (lstat(path, &path_stat) == -1) +@@ -532,15 +533,25 @@ + if (!S_ISLNK(path_stat.st_mode)) { + if (access(path, F_OK) != 0) + goto EXIT; +- } else if ((ptr = rindex(path, '/'))) { +- *ptr = 0; +- if (access(path, F_OK) == 0) +- ret = 1; +- *ptr = '/'; +- goto EXIT; + } + ++ /* "path" is const, so we shouldn't modify it. Also, for speed, ++ * I suspect strdup/free is less expensive than the deep access ++ * checks... */ ++ if (!(path_copy = strdup(path))) ++ goto EXIT; ++ + ret = 1; ++ ++ /* Each directory leading to the file (symlink or not) must be ++ * readable for us to allow it to be listed in search results. */ ++ while (ret && (ptr=rindex(path_copy,'/'))) { ++ *ptr=0; ++ if (*path_copy && access(path_copy, R_OK) != 0) ++ ret = 0; ++ } ++ free(path_copy); ++ + EXIT: + return ret; + } diff --git a/source/a/slocate/slocate.SlackBuild b/source/a/slocate/slocate.SlackBuild index eef2fd1f..def08b8c 100755 --- a/source/a/slocate/slocate.SlackBuild +++ b/source/a/slocate/slocate.SlackBuild @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, Minnesota, USA +# Copyright 2008, 2009, 2010, 2012 Patrick J. Volkerding, Sebeka, Minnesota, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -22,7 +22,7 @@ VERSION=3.1 -BUILD=${BUILD:-3} +BUILD=${BUILD:-4} # Automatically determine the architecture we're building on: if [ -z "$ARCH" ]; then @@ -55,8 +55,12 @@ explodepkg $CWD/_slocate.tar.gz cd $TMP rm -rf slocate-$VERSION -tar xzvf $CWD/slocate-$VERSION.tar.gz -cd slocate-$VERSION +tar xzvf $CWD/slocate-$VERSION.tar.gz || exit 1 +cd slocate-$VERSION || exit 1 + +zcat $CWD/slocate.bigfile.diff.gz | patch -p0 --verbose || exit 1 +zcat $CWD/slocate.CVE-2007-0277.diff.gz | patch -p1 --verbose || exit 1 + chown -R root:root . find . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 2750 -o -perm 711 -o -perm 555 -o -perm 511 \) \ @@ -65,7 +69,7 @@ find . \ -exec chmod 644 {} \; cd src -make CFLAGS="$SLKCFLAGS" +make CFLAGS="$SLKCFLAGS -D_LARGEFILE64_SOURCE" || exit 1 cd .. strip --strip-unneeded src/slocate mkdir -p $PKG/usr/bin diff --git a/source/a/slocate/slocate.bigfile.diff b/source/a/slocate/slocate.bigfile.diff new file mode 100644 index 00000000..6ccd1202 --- /dev/null +++ b/source/a/slocate/slocate.bigfile.diff @@ -0,0 +1,33 @@ +Fix 2GB limitation - brought to you by mancha + +--- src/utils.c.orig 2012-08-25 ++++ src/utils.c 2012-08-25 +@@ -284,12 +284,12 @@ int + verify_slocate_db(struct g_data_s *g_data, char *file) + { + char ch[1]; +- struct stat tf_stat; ++ struct stat64 tf_stat; + int bytes = 0; + int fd = -1; + + if (access(file, W_OK | R_OK) == 0) { +- if (lstat(file, &tf_stat) == -1) { ++ if (lstat64(file, &tf_stat) == -1) { + if (!report_error(g_data, FATAL, "get_temp_file: fstat(): %s: %s\n", file, strerror(errno))) + goto EXIT; + +@@ -522,11 +522,11 @@ EXIT: + * to check them separately */ + int verify_access(const char *path) + { +- struct stat path_stat; ++ struct stat64 path_stat; + int ret = 0; + char *ptr = NULL; + +- if (lstat(path, &path_stat) == -1) ++ if (lstat64(path, &path_stat) == -1) + goto EXIT; + + if (!S_ISLNK(path_stat.st_mode)) { |