aboutsummaryrefslogtreecommitdiff
path: root/archivers/lha/files/patch-dir_length_bounds_check
diff options
context:
space:
mode:
authorDirk Meyer <dinoex@FreeBSD.org>2004-09-04 19:28:25 +0000
committerDirk Meyer <dinoex@FreeBSD.org>2004-09-04 19:28:25 +0000
commit97c722485427245ed27c690f1ce55f4153314531 (patch)
tree2058978d9f45707c53d950eddcb253818cf746c7 /archivers/lha/files/patch-dir_length_bounds_check
parent1b7e47de7104d8cc62ea609102743485b86c717b (diff)
downloadports-97c722485427245ed27c690f1ce55f4153314531.tar.gz
ports-97c722485427245ed27c690f1ce55f4153314531.zip
Notes
Diffstat (limited to 'archivers/lha/files/patch-dir_length_bounds_check')
-rw-r--r--archivers/lha/files/patch-dir_length_bounds_check20
1 files changed, 20 insertions, 0 deletions
diff --git a/archivers/lha/files/patch-dir_length_bounds_check b/archivers/lha/files/patch-dir_length_bounds_check
new file mode 100644
index 000000000000..7a0ae1e086e2
--- /dev/null
+++ b/archivers/lha/files/patch-dir_length_bounds_check
@@ -0,0 +1,20 @@
+--- src/header.c 2002-07-19 17:23:58.000000000 +0900
++++ src/header.c 2004-06-16 09:49:23.000000000 +0900
+@@ -648,8 +648,17 @@
+ }
+
+ if (dir_length) {
++ if ((dir_length + name_length) > sizeof(dirname)) {
++ fprintf(stderr, "Insufficient buffer size\n");
++ exit(112);
++ }
+ strcat(dirname, hdr->name);
+- strcpy(hdr->name, dirname);
++
++ if ((dir_length + name_length) > sizeof(hdr->name)) {
++ fprintf(stderr, "Insufficient buffer size\n");
++ exit(112);
++ }
++ strncpy(hdr->name, dirname, sizeof(hdr->name));
+ name_length += dir_length;
+ }