Re: [Dovecot] Patch for pigeonhole 0.4.0 avoiding PATH_MAX
On Tue, 2013-06-18 at 12:25 +0200, Svante Signell wrote: > On Tue, 2013-06-18 at 08:37 +0200, Stephan Bosch wrote: > > On 6/15/2013 3:24 PM, Svante Signell wrote: > > > Hi, > > > > > > I recently downloaded and built dovecot-2.2.2 and > > > dovecot-2.2-pigeonhole-0.4.0 on GNU/Linux and GNU/Hurd. The changes > > > needed will be sent to the Debian maintainer shortly. Latest Debian > > > release is 2.1.7-7 and dovecot-2.1-pigeonhole-0.3.1. When building > > > dovecot-2.2.2 there were no PATH_MAX problems on GNU/Hurd, thank you for > > > that. However, pigeonhole 0.4.0 had one remaining PATH_MAX construct. > > > The attached patch solves this problem. It it good enough to be accepted > > > upstream? (According to the description of t_malloc, free is not needed, > > > right?) > > > > Fixed: > > > > http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/1b1a0c271383 > > Thanks a lot :) Are you planning to make a new (minor) release of pigeonhole soon, just to know what to submit in the bug report to the Debian maintainer?
Re: [Dovecot] Patch for pigeonhole 0.4.0 avoiding PATH_MAX
On Tue, 2013-06-18 at 08:37 +0200, Stephan Bosch wrote: > On 6/15/2013 3:24 PM, Svante Signell wrote: > > Hi, > > > > I recently downloaded and built dovecot-2.2.2 and > > dovecot-2.2-pigeonhole-0.4.0 on GNU/Linux and GNU/Hurd. The changes > > needed will be sent to the Debian maintainer shortly. Latest Debian > > release is 2.1.7-7 and dovecot-2.1-pigeonhole-0.3.1. When building > > dovecot-2.2.2 there were no PATH_MAX problems on GNU/Hurd, thank you for > > that. However, pigeonhole 0.4.0 had one remaining PATH_MAX construct. > > The attached patch solves this problem. It it good enough to be accepted > > upstream? (According to the description of t_malloc, free is not needed, > > right?) > > Fixed: > > http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/1b1a0c271383 Thanks a lot :)
[Dovecot] Patch for pigeonhole 0.4.0 avoiding PATH_MAX
Hi, I recently downloaded and built dovecot-2.2.2 and dovecot-2.2-pigeonhole-0.4.0 on GNU/Linux and GNU/Hurd. The changes needed will be sent to the Debian maintainer shortly. Latest Debian release is 2.1.7-7 and dovecot-2.1-pigeonhole-0.3.1. When building dovecot-2.2.2 there were no PATH_MAX problems on GNU/Hurd, thank you for that. However, pigeonhole 0.4.0 had one remaining PATH_MAX construct. The attached patch solves this problem. It it good enough to be accepted upstream? (According to the description of t_malloc, free is not needed, right?) Thanks, Svante Signell Index: dovecot-2.2.2/pigeonhole/src/lib-sievestorage/sieve-storage-script.c === --- dovecot-2.2.2.orig/pigeonhole/src/lib-sievestorage/sieve-storage-script.c 2013-06-15 15:12:58.0 +0200 +++ dovecot-2.2.2/pigeonhole/src/lib-sievestorage/sieve-storage-script.c 2013-06-15 15:18:34.0 +0200 @@ -118,12 +118,24 @@ static int sieve_storage_read_active_link (struct sieve_storage *storage, const char **link_r) { - char linkbuf[PATH_MAX]; + struct stat st; + char *linkbuf; int ret; *link_r = NULL; - ret = readlink(storage->active_path, linkbuf, sizeof(linkbuf)); + /* Stat the file */ + if ( lstat(storage->active_path, &st) != 0 ) { + if ( errno != ENOENT ) { + sieve_storage_set_critical(storage, +"Failed to stat active sieve script symlink (%s): %m.", +storage->active_path); + return -1; + } + } + linkbuf = t_malloc(st.st_size + 1); + + ret = readlink(storage->active_path, linkbuf, st.st_size+1); if ( ret < 0 ) { if ( errno == EINVAL ) {