- fix a crash when using tab-completion for selecting a save filename

(from alpine SVN)
- regen PLIST while here

reported to and fixed by upstream
issue spotted by Jonathan Thornburg <J.Thornburg at soton.ac dot uk>
This commit is contained in:
ajacoutot 2008-06-12 21:47:20 +00:00
parent 5b957a17ad
commit e02a94359d
8 changed files with 111 additions and 12 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.5 2008/05/20 07:17:16 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.6 2008/06/12 21:47:20 ajacoutot Exp $
COMMENT-main= UW e-mail client
COMMENT-pico= UW text editor
@ -14,9 +14,9 @@ CATEGORIES= mail news
CATEGORIES-pico=editors
CATEGORIES-pilot=sysutils
PKGNAME-main= alpine-${V}
PKGNAME-pico= pico-${PICO_V}
PKGNAME-pilot= pilot-${PILOT_V}
PKGNAME-main= alpine-${V}p0
PKGNAME-pico= pico-${PICO_V}p0
PKGNAME-pilot= pilot-${PILOT_V}p0
MAINTAINER= Antoine Jacoutot <ajacoutot@openbsd.org>

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-alpine_mailcmd_c,v 1.1 2008/06/12 21:47:20 ajacoutot Exp $
--- alpine/mailcmd.c.orig Fri Feb 29 19:18:49 2008
+++ alpine/mailcmd.c Thu Jun 12 23:15:54 2008
@@ -4468,7 +4468,7 @@ get_export_filename(struct pine *ps, char *filename, c
}
}
else{ /* File Completion */
- if(!pico_fncomplete(dir2, sizeof(dir2), filename2, sizeof(filename2)))
+ if(!pico_fncomplete(dir2, filename2, sizeof(filename2)))
Writechar(BELL, 0);
strncat(postcolon, filename2,
sizeof(postcolon)-1-strlen(postcolon));

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-pico_attach_c,v 1.1 2008/06/12 21:47:20 ajacoutot Exp $
--- pico/attach.c.orig Wed Feb 6 00:09:15 2008
+++ pico/attach.c Thu Jun 12 23:15:54 2008
@@ -179,7 +179,7 @@ AskAttach(char *cmnt, size_t cmntlen, LMLIST **lm)
bfn[sizeof(bfn)-1] = '\0';
}
- if(!pico_fncomplete(bfn, sizeof(bfn), fname, sizeof(fn)-(fname-fn)))
+ if(!pico_fncomplete(bfn, fname, sizeof(fn)-(fname-fn)))
(*term.t_beep)();
}
else

View File

@ -0,0 +1,63 @@
$OpenBSD: patch-pico_file_c,v 1.1 2008/06/12 21:47:20 ajacoutot Exp $
--- pico/file.c.orig Thu Dec 6 20:57:49 2007
+++ pico/file.c Thu Jun 12 23:15:54 2008
@@ -212,7 +212,7 @@ insfile(int f, int n)
dir[0] = '\0';
fn = file_split(dir, sizeof(dir), fname, 0);
- if(!pico_fncomplete(dir, sizeof(dir), fn, sizeof(fname)-(fn-fname)))
+ if(!pico_fncomplete(dir, fn, sizeof(fname)-(fn-fname)))
(*term.t_beep)();
}
@@ -650,7 +650,7 @@ filewrite(int f, int n)
dir[sizeof(dir)-1] = '\0';
}
- if(!pico_fncomplete(dir, sizeof(dir), fn, sizeof(fname)-(fn-fname)))
+ if(!pico_fncomplete(dir, fn, sizeof(fname)-(fn-fname)))
(*term.t_beep)();
}
@@ -1004,9 +1004,9 @@ ifile(char fname[])
* pico_fncomplete - pico's function to complete the given file name
*/
int
-pico_fncomplete(char *dir, size_t dirlen, char *fn, size_t fnlen)
+pico_fncomplete(char *dirarg, char *fn, size_t fnlen)
{
- char *p, *dlist, tmp[NLINE], dtmp[NLINE];
+ char *p, *dlist, tmp[NLINE], dir[NLINE];
int n, i, match = -1;
#ifdef DOS
#define FILECMP(x, y) (toupper((unsigned char)(x))\
@@ -1015,9 +1015,9 @@ pico_fncomplete(char *dir, size_t dirlen, char *fn, si
#define FILECMP(x, y) ((x) == (y))
#endif
- strncpy(dtmp, dir, sizeof(dtmp));
- dtmp[sizeof(dtmp)-1] = '\0';
- pfnexpand(dir = dtmp, sizeof(dtmp));
+ strncpy(dir, dirarg, sizeof(dir));
+ dir[sizeof(dir)-1] = '\0';
+ pfnexpand(dir, sizeof(dir));
if(*fn && (dlist = p = getfnames(dir, fn, &n, NULL, 0))){
memset(tmp, 0, sizeof(tmp));
while(n--){ /* any names in it */
@@ -1049,11 +1049,11 @@ pico_fncomplete(char *dir, size_t dirlen, char *fn, si
strncpy(fn, tmp, fnlen);
fn[fnlen-1] = '\0';
if(match == 1){
- if ((strlen(dir)+strlen(S_FILESEP)+strlen(fn)) < dirlen){
- strncat(dir, S_FILESEP, dirlen-strlen(dir)-1);
- dir[dirlen-1] = '\0';
- strncat(dir, fn, dirlen-strlen(dir)-1);
- dir[dirlen-1] = '\0';
+ if ((strlen(dir)+strlen(S_FILESEP)+strlen(fn)) < sizeof(dir)){
+ strncat(dir, S_FILESEP, sizeof(dir)-strlen(dir)-1);
+ dir[sizeof(dir)-1] = '\0';
+ strncat(dir, fn, sizeof(dir)-strlen(dir)-1);
+ dir[sizeof(dir)-1] = '\0';
if(isdir(dir, NULL, NULL)){
strncat(fn, S_FILESEP, fnlen-strlen(fn)-1);
fn[fnlen-1] = '\0';

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-pico_pico_h,v 1.1 2008/06/12 21:47:20 ajacoutot Exp $
--- pico/pico.h.orig Sat Mar 15 00:53:39 2008
+++ pico/pico.h Thu Jun 12 23:15:54 2008
@@ -428,7 +428,7 @@ int pico_writec(void *w, int c, int flags);
int pico_puts(void *w, char *s, int flags);
int pico_seek(void *w, long offset, int orig);
int pico_replace(void *, char *);
-int pico_fncomplete(char *, size_t, char *, size_t);
+int pico_fncomplete(char *, char *, size_t);
#if defined(DOS) || defined(OS2)
int pico_nfsetcolor(char *);
int pico_nbsetcolor(char *);

View File

@ -1,9 +1,9 @@
@comment $OpenBSD: PLIST-main,v 1.2 2007/12/07 17:56:01 ajacoutot Exp $
@comment $OpenBSD: PLIST-main,v 1.3 2008/06/12 21:47:20 ajacoutot Exp $
@conflict pine-*
@pkgpath mail/pine
bin/alpine
bin/rpdump
bin/rpload
@bin bin/alpine
@bin bin/rpdump
@bin bin/rpload
@man man/man1/alpine.1
@man man/man1/rpdump.1
@man man/man1/rpload.1

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-pico,v 1.1.1.1 2007/11/22 13:49:52 ajacoutot Exp $
@comment $OpenBSD: PLIST-pico,v 1.2 2008/06/12 21:47:20 ajacoutot Exp $
@pkgpath mail/pine,pico
bin/pico
@bin bin/pico
@man man/man1/pico.1

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-pilot,v 1.1.1.1 2007/11/22 13:49:52 ajacoutot Exp $
@comment $OpenBSD: PLIST-pilot,v 1.2 2008/06/12 21:47:20 ajacoutot Exp $
@pkgpath mail/pine,pilot
bin/pilot
@bin bin/pilot
@man man/man1/pilot.1