diff options
Diffstat (limited to 'app-arch/lha/files/lha-114i-dir_length_bounds_check.patch')
-rw-r--r-- | app-arch/lha/files/lha-114i-dir_length_bounds_check.patch | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app-arch/lha/files/lha-114i-dir_length_bounds_check.patch b/app-arch/lha/files/lha-114i-dir_length_bounds_check.patch new file mode 100644 index 000000000000..78543673b982 --- /dev/null +++ b/app-arch/lha/files/lha-114i-dir_length_bounds_check.patch @@ -0,0 +1,20 @@ +--- lha-114i/src/header.c ++++ lha-114i/src/header.c +@@ -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; + } |