From b4bc02dcd527a1b7c711e3bb3727163a7a9aaf79 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 12 Feb 2007 23:57:42 +0000 Subject: [PATCH] * dpkg-deb/dpkg-deb.h (MAXFILENAME): New macro. * dpkg-deb/build.c (getfi): Use MAXFILENAME instead of the hardcoded value '2048'. --- ChangeLog | 6 ++++++ dpkg-deb/build.c | 10 +++++----- dpkg-deb/dpkg-deb.h | 2 ++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ca73ee9..22d5eadd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-02-13 Guillem Jover + + * dpkg-deb/dpkg-deb.h (MAXFILENAME): New macro. + * dpkg-deb/build.c (getfi): Use MAXFILENAME instead of the hardcoded + value '2048'. + 2007-02-13 Guillem Jover * lib/compression.c (decompress_cat): Use BZ_IO_ERROR instead of diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c index 6c7fc3f0..50fb6327 100644 --- a/dpkg-deb/build.c +++ b/dpkg-deb/build.c @@ -80,10 +80,10 @@ static struct _finfo* getfi(const char* root, int fd) { size_t rl = strlen(root); if (fn == NULL) { - fnlen=rl+2048; + fnlen = rl + MAXFILENAME; fn=(char*)malloc(fnlen); - } else if (fnlen < (rl+2048)) { - fnlen=rl+2048; + } else if (fnlen < (rl + MAXFILENAME)) { + fnlen = rl + MAXFILENAME; fn=(char*)realloc(fn,fnlen); } i=sprintf(fn,"%s/",root); @@ -91,7 +91,7 @@ static struct _finfo* getfi(const char* root, int fd) { while (1) { int res; if (i>=fnlen) { - fnlen+=2048; + fnlen += MAXFILENAME; fn=(char*)realloc(fn,fnlen); } if ((res=read(fd, (fn+i), sizeof(*fn)))<0) { @@ -106,7 +106,7 @@ static struct _finfo* getfi(const char* root, int fd) { break; i++; - assert(i<2048); + assert(i < MAXFILENAME); } fi=(struct _finfo*)malloc(sizeof(struct _finfo)); diff --git a/dpkg-deb/dpkg-deb.h b/dpkg-deb/dpkg-deb.h index daa9c74c..cc8dc7e7 100644 --- a/dpkg-deb/dpkg-deb.h +++ b/dpkg-deb/dpkg-deb.h @@ -50,4 +50,6 @@ extern enum compression_type compress_type; #define DATAMEMBER_CAT "data.tar " #define DATAMEMBER_COMPAT_CAT "data.tar/ " +#define MAXFILENAME 2048 + #endif /* DPKG_DEB_H */ -- 2.39.5