* dump_setup.cc (check_package_files): Fix extra '/' in filename.

Resize command buffer.  Fix buffer overflow bug.
This commit is contained in:
Corinna Vinschen 2003-08-13 19:37:40 +00:00
parent db979bb4cf
commit e2b1a74c13
2 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2003-08-13 Igor Pechtchanski <pechtcha@cs.nyu.edu>
* dump_setup.cc (check_package_files): Fix extra '/' in filename.
Resize command buffer. Fix buffer overflow bug.
2003-08-09 Igor Pechtchanski <pechtcha@cs.nyu.edu> 2003-08-09 Igor Pechtchanski <pechtcha@cs.nyu.edu>
Christopher Faylor <cgf@redhat.com> Christopher Faylor <cgf@redhat.com>

View File

@ -237,7 +237,7 @@ file_exists (int verbose, char *filename, const char *alt, char *package)
static bool static bool
check_package_files (int verbose, char *package) check_package_files (int verbose, char *package)
{ {
char filelist[MAX_PATH + 1] = "/etc/setup/"; char filelist[MAX_PATH + 1] = "etc/setup/";
strcat (strcat (filelist, package), ".lst.gz"); strcat (strcat (filelist, package), ".lst.gz");
if (!file_exists (false, filelist, NULL, NULL)) if (!file_exists (false, filelist, NULL, NULL))
{ {
@ -253,8 +253,8 @@ check_package_files (int verbose, char *package)
zcat = cygpath ("/bin/gzip.exe", NULL); zcat = cygpath ("/bin/gzip.exe", NULL);
while (char *p = strchr (zcat, '/')) while (char *p = strchr (zcat, '/'))
*p = '\\'; *p = '\\';
zcat = (char *) realloc (zcat, strlen (zcat) + sizeof (" -dc ") + 4096); zcat = (char *) realloc (zcat, strlen (zcat) + sizeof (" -dc /") + MAX_PATH);
zcat_end = strchr (strcat (zcat, " -dc "), '\0'); zcat_end = strchr (strcat (zcat, " -dc /"), '\0');
} }
strcpy (zcat_end, filelist); strcpy (zcat_end, filelist);
@ -262,7 +262,7 @@ check_package_files (int verbose, char *package)
bool result = true; bool result = true;
char buf[MAX_PATH + 1]; char buf[MAX_PATH + 1];
while (fgets (buf, 4096, fp)) while (fgets (buf, MAX_PATH, fp))
{ {
char *filename = strtok(buf, "\n"); char *filename = strtok(buf, "\n");
if (filename[strlen (filename) - 1] == '/') if (filename[strlen (filename) - 1] == '/')