[SCM] faad2/master: Dynamically allocate file name buffers, instead of relying on PATH_MAX. Done without free()ing the file names, as the program is about to return() anyway.
fabian-guest at users.alioth.debian.org
fabian-guest at users.alioth.debian.org
Fri Nov 4 12:34:14 UTC 2011
The following commit has been merged in the master branch:
commit 8b772f9e350200067e8ab9d433b510aad0a85f3c
Author: Fabian Greffrath <fabian+debian at greffrath.com>
Date: Fri Nov 4 13:37:08 2011 +0100
Dynamically allocate file name buffers, instead of relying on PATH_MAX.
Done without free()ing the file names, as the program is about to return() anyway.
diff --git a/debian/patches/path_max.patch b/debian/patches/path_max.patch
index a1c8525..451d939 100644
--- a/debian/patches/path_max.patch
+++ b/debian/patches/path_max.patch
@@ -1,76 +1,52 @@
-Description: Extend file name buffers for longer path names
- and fix potential buffer overruns for even longer pathnames.
+Description: Dynamically allocate file name buffers.
Author: Fabian Greffrath <fabian+debian at greffrath.com>
-Forwarded: menno at audiocoding.com
Bug-Ubuntu: https://launchpad.net/bugs/475050
+Last-Update: 2011-11-04
---- faad2.orig/frontend/main.c
-+++ faad2/frontend/main.c
-@@ -42,6 +42,11 @@
- #include <stdlib.h>
- #include <string.h>
- #include <getopt.h>
-+#include <limits.h>
-+
-+#ifndef PATH_MAX
-+#define PATH_MAX 1023
-+#endif
-
- #include <neaacdec.h>
- #include <mp4ff.h>
-@@ -1107,9 +1112,9 @@ int main(int argc, char *argv[])
+--- faad.orig/frontend/main.c
++++ faad/frontend/main.c
+@@ -1107,9 +1107,9 @@ int main(int argc, char *argv[])
int mp4file = 0;
int noGapless = 0;
char *fnp;
- char aacFileName[255];
- char audioFileName[255];
- char adtsFileName[255];
-+ char aacFileName[PATH_MAX + 1];
-+ char audioFileName[PATH_MAX + 1];
-+ char adtsFileName[PATH_MAX + 1];
++ char *aacFileName;
++ char *audioFileName;
++ char *adtsFileName;
unsigned char header[8];
float length = 0;
FILE *hMP4File;
-@@ -1157,14 +1162,14 @@ int main(int argc, char *argv[])
+@@ -1157,6 +1157,7 @@ int main(int argc, char *argv[])
if (optarg)
{
outfile_set = 1;
-- strcpy(audioFileName, optarg);
-+ strncpy(audioFileName, optarg, PATH_MAX);
++ audioFileName = (char *) malloc(strlen(optarg) + 1);
+ strcpy(audioFileName, optarg);
}
break;
- case 'a':
+@@ -1164,6 +1165,7 @@ int main(int argc, char *argv[])
if (optarg)
{
adts_out = 1;
-- strcpy(adtsFileName, optarg);
-+ strncpy(adtsFileName, optarg, PATH_MAX);
++ adtsFileName = (char *) malloc(strlen(optarg) + 1);
+ strcpy(adtsFileName, optarg);
}
break;
- case 's':
-@@ -1284,7 +1289,7 @@ int main(int argc, char *argv[])
+@@ -1284,6 +1286,7 @@ int main(int argc, char *argv[])
#endif
/* point to the specified file name */
-- strcpy(aacFileName, argv[optind]);
-+ strncpy(aacFileName, argv[optind], PATH_MAX);
++ aacFileName = (char *) malloc(strlen(argv[optind]) + 1);
+ strcpy(aacFileName, argv[optind]);
#ifdef _WIN32
- begin = GetTickCount();
-@@ -1297,14 +1302,14 @@ int main(int argc, char *argv[])
+@@ -1297,6 +1300,7 @@ int main(int argc, char *argv[])
*/
if(!writeToStdio && !outfile_set)
{
-- strcpy(audioFileName, aacFileName);
-+ strncpy(audioFileName, aacFileName, PATH_MAX);
++ audioFileName = (char *) malloc(strlen(aacFileName) + 1 + strlen(file_ext[format]) + 1);
+ strcpy(audioFileName, aacFileName);
fnp = (char *)strrchr(audioFileName,'.');
-
- if (fnp)
- fnp[0] = '\0';
-
-- strcat(audioFileName, file_ext[format]);
-+ strncat(audioFileName, file_ext[format], PATH_MAX - strlen(audioFileName));
- }
-
- /* check for mp4 file */
--
faad2 packaging
More information about the pkg-multimedia-commits
mailing list