summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2006-06-26 16:11:43 +0000
committerjoerg <joerg@pkgsrc.org>2006-06-26 16:11:43 +0000
commit1e837f5f6e2325c98de12553e11f37b4f2acfe7b (patch)
treed1c6ad178fc291694f50ec70ef30108a0344abb7
parent5bd4fae570d0d8da657dbfed44b3d67c7fa61b51 (diff)
downloadpkgsrc-1e837f5f6e2325c98de12553e11f37b4f2acfe7b.tar.gz
Prefer the POSIX NAME_MAX over MAXNAMLEN when available. Try a bit
harder to avoid stack overflows, bump revision for that.
-rw-r--r--graphics/xbmbrowser/Makefile4
-rw-r--r--graphics/xbmbrowser/distinfo6
-rw-r--r--graphics/xbmbrowser/patches/patch-ab53
-rw-r--r--graphics/xbmbrowser/patches/patch-ac32
-rw-r--r--graphics/xbmbrowser/patches/patch-ad44
-rw-r--r--graphics/xbmbrowser/patches/patch-ae77
6 files changed, 213 insertions, 3 deletions
diff --git a/graphics/xbmbrowser/Makefile b/graphics/xbmbrowser/Makefile
index dd2aaf6aeb5..b4458ad620e 100644
--- a/graphics/xbmbrowser/Makefile
+++ b/graphics/xbmbrowser/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.24 2006/03/04 21:29:52 jlam Exp $
+# $NetBSD: Makefile,v 1.25 2006/06/26 16:11:43 joerg Exp $
DISTNAME= xbmbrowser5.1
PKGNAME= xbmbrowser-5.1
-PKGREVISION= 2
+PKGREVISION= 3
CATEGORIES= graphics
MASTER_SITES= ${MASTER_SITE_XCONTRIB:=utilities/}
diff --git a/graphics/xbmbrowser/distinfo b/graphics/xbmbrowser/distinfo
index b3bcc7ccaf3..7231488f3e7 100644
--- a/graphics/xbmbrowser/distinfo
+++ b/graphics/xbmbrowser/distinfo
@@ -1,6 +1,10 @@
-$NetBSD: distinfo,v 1.5 2005/02/24 08:45:14 agc Exp $
+$NetBSD: distinfo,v 1.6 2006/06/26 16:11:43 joerg Exp $
SHA1 (xbmbrowser5.1.tar.gz) = b7e6ed6509fbf985dc4348cb45c67047cd5e87dc
RMD160 (xbmbrowser5.1.tar.gz) = 12334c23e95c19f13811315ce8ad522126d86e6e
Size (xbmbrowser5.1.tar.gz) = 74397 bytes
SHA1 (patch-aa) = 1c1087555ca33e3319810b8f66cf510b047f8233
+SHA1 (patch-ab) = cc7e87ea599664f94ff8c791efb3d4820197cc45
+SHA1 (patch-ac) = e78c96437e4dbf41f064983fe0a96a08bf3a67f6
+SHA1 (patch-ad) = 335297bb9c7df40007118e162e0624214d249677
+SHA1 (patch-ae) = 51b95dde72bcb95b426401458088750eb026cc43
diff --git a/graphics/xbmbrowser/patches/patch-ab b/graphics/xbmbrowser/patches/patch-ab
new file mode 100644
index 00000000000..28f2929d57e
--- /dev/null
+++ b/graphics/xbmbrowser/patches/patch-ab
@@ -0,0 +1,53 @@
+$NetBSD: patch-ab,v 1.1 2006/06/26 16:11:43 joerg Exp $
+
+--- xbmbrowser.h.orig 2006-06-26 15:27:35.000000000 +0000
++++ xbmbrowser.h
+@@ -27,6 +27,7 @@
+ #include <stdio.h> /* C library includes */
+ #include <dirent.h> /* Filename length (and dir functions) */
+ #include <assert.h> /* debugging assertions */
++#include <limits.h>
+
+ #include <X11/Xaw/Form.h> /* widget includes */
+ #include <X11/Xaw/Box.h>
+@@ -82,8 +83,13 @@ enum FileType {
+ /* item structure */
+ typedef struct _item {
+ struct _item *next; /* next item */
++#ifdef NAME_MAX
++ char fname[NAME_MAX]; /* This files name in current dir */
++ char info[NAME_MAX+40]; /* information to display about icon */
++#else
+ char fname[MAXNAMLEN]; /* This files name in current dir */
+ char info[MAXNAMLEN+40]; /* information to display about icon */
++#endif
+ time_t mtime; /* last modification time */
+ enum FileType type; /* file type */
+ Boolean visible; /* visible to user? */
+@@ -167,6 +173,18 @@ ext Widget menu_bitmap, menu_pixmap;
+ ext Widget menu_directory, menu_other;
+
+ /* substitution strings for function argument macro substitions */
++#ifdef NAME_MAX
++ext char dir_name[NAME_MAX]; /* %d the current directory */
++ext char file_name[NAME_MAX]; /* %f current filename */
++ext char base_name[NAME_MAX]; /* %b basename for current file */
++ext char suffix[NAME_MAX]; /* %s suffix of current file */
++ext char input[NAME_MAX]; /* %i input string from user */
++ext char home_dir[NAME_MAX]; /* %h the users home directory */
++ext char init_dir[NAME_MAX]; /* %D initial startup directory */
++
++/* Information strings for display in application label */
++ext char label_info[NAME_MAX]; /* label to show when outside bitmap */
++#else
+ ext char dir_name[MAXNAMLEN]; /* %d the current directory */
+ ext char file_name[MAXNAMLEN]; /* %f current filename */
+ ext char base_name[MAXNAMLEN]; /* %b basename for current file */
+@@ -177,6 +195,7 @@ ext char init_dir[MAXNAMLEN]; /*
+
+ /* Information strings for display in application label */
+ ext char label_info[MAXNAMLEN]; /* label to show when outside bitmap */
++#endif
+ ext Item *current_item; /* which item the user is pointing to */
+
+ /* some external variables */
diff --git a/graphics/xbmbrowser/patches/patch-ac b/graphics/xbmbrowser/patches/patch-ac
new file mode 100644
index 00000000000..f4114c8fda4
--- /dev/null
+++ b/graphics/xbmbrowser/patches/patch-ac
@@ -0,0 +1,32 @@
+$NetBSD: patch-ac,v 1.1 2006/06/26 16:11:43 joerg Exp $
+
+--- misc.c.orig 2006-06-26 15:29:28.000000000 +0000
++++ misc.c
+@@ -181,9 +181,15 @@ read_dir(dir)
+ last_link = &(item->next);
+ count++;
+
++#ifdef NAME_MAX
++ if( subdir )
++ strncpy(item->fname, dir, NAME_MAX);
++ strncat(item->fname, dp->d_name, NAME_MAX);
++#else
+ if( subdir )
+ strncpy(item->fname, dir, MAXNAMLEN);
+ strncat(item->fname, dp->d_name, MAXNAMLEN);
++#endif
+
+ stat(item->fname, &info); /* discover information about this file */
+
+@@ -195,7 +201,11 @@ read_dir(dir)
+ if( S_ISDIR(info.st_mode) ) { /* IF directory -- check if sym-link */
+ lstat(item->fname, &info);
+ item->type = ( S_ISLNK(info.st_mode) ? DirLink : Dir );
++#ifdef NAME_MAX
++ strncat(item->fname, "/", NAME_MAX); /* append `/' to dir name */
++#else
+ strncat(item->fname, "/", MAXNAMLEN); /* append `/' to dir name */
++#endif
+ if( app_data.recursive ) /* do recursion if needed */
+ if( ! read_dir( item->fname ) )
+ item->type = DirBad;
diff --git a/graphics/xbmbrowser/patches/patch-ad b/graphics/xbmbrowser/patches/patch-ad
new file mode 100644
index 00000000000..701eff3a718
--- /dev/null
+++ b/graphics/xbmbrowser/patches/patch-ad
@@ -0,0 +1,44 @@
+$NetBSD: patch-ad,v 1.1 2006/06/26 16:11:43 joerg Exp $
+
+--- xbmbrowser.c.orig 2006-06-26 15:30:08.000000000 +0000
++++ xbmbrowser.c
+@@ -279,7 +279,11 @@ main(argc, argv)
+ { extern char *getenv();
+ (void) strcpy(home_dir, getenv("HOME"));
+ if( strcmp(home_dir,"/") != 0 )
++#ifdef NAME_MAX
++ (void) strncat(home_dir, "/", NAME_MAX);
++#else
+ (void) strncat(home_dir, "/", MAXNAMLEN);
++#endif
+ }
+
+ /* Initialize other substitution strings */
+@@ -314,7 +318,11 @@ main(argc, argv)
+ /* Initialize user menus from the appropiate RC file */
+ /* Do this before we chdir() into some other directory */
+ { FILE *rc;
++#ifdef NAME_MAX
++ char rcfile[NAME_MAX];
++#else
+ char rcfile[MAXNAMLEN];
++#endif
+
+ menu_global = menu_bitmap = menu_pixmap =
+ menu_directory = menu_other = NULL;
+@@ -358,9 +366,15 @@ main(argc, argv)
+ fprintf(stderr,"xbmbrowser: couldn't chdir to '%s'\n",argv[1]);
+ exit(-1);
+ }
++#ifdef NAME_MAX
++ (void) getcwd(dir_name, NAME_MAX);
++ if( strcmp(dir_name,"/") != 0 )
++ (void) strncat(dir_name, "/", NAME_MAX);
++#else
+ (void) getcwd(dir_name, MAXNAMLEN);
+ if( strcmp(dir_name,"/") != 0 )
+ (void) strncat(dir_name, "/", MAXNAMLEN);
++#endif
+
+ /* copy this as the initial startup directory */
+ strcpy(init_dir, dir_name);
diff --git a/graphics/xbmbrowser/patches/patch-ae b/graphics/xbmbrowser/patches/patch-ae
new file mode 100644
index 00000000000..735685335ac
--- /dev/null
+++ b/graphics/xbmbrowser/patches/patch-ae
@@ -0,0 +1,77 @@
+$NetBSD: patch-ae,v 1.1 2006/06/26 16:11:43 joerg Exp $
+
+--- user_functs.c.orig 1995-07-23 07:13:56.000000000 +0000
++++ user_functs.c
+@@ -44,7 +44,11 @@ void expand_tilder(text)
+ */
+ char *text;
+ {
++#ifdef NAME_MAX
++ static char buf[NAME_MAX];
++#else
+ static char buf[MAXNAMLEN];
++#endif
+ char *s, *t, *t1;
+ struct passwd *p, *getpwnam();
+
+@@ -60,9 +64,9 @@ void expand_tilder(text)
+ if(*buf && (p = getpwnam(buf)) == '\0') /* find correct home */
+ return; /* error -- return */
+ t1 = *buf ? p->pw_dir : home_dir;
+- t = buf;
+- strcpy(t, t1); /* buf <- home_dir */
+- strcat(t, s); /* copy rest of text into buf */
++ strncpy(buf, t1, sizeof(buf) - 1); /* buf <- home_dir */
++ buf[sizeof(buf) - 1] = '\0';
++ strncat(buf, s, sizeof(buf) - 1 - strlen(buf)); /* copy rest of text into buf */
+
+ strcpy(text, buf); /* copy it back and return it */
+ }
+@@ -75,7 +79,17 @@ change_dir(dir)
+ */
+ char *dir;
+ {
++#ifdef NAME_MAX
++# if NAME_MAX < 1028
+ char newdir[1028];
++# else
++ char newdir[NAME_MAX];
++#endif
++#elif MAXNAMLEN < 1028
++ char newdir[1028];
++#else
++ char newdir[MAXNAMLEN];
++#endif
+
+ strcpy(newdir, dir); /* save the given variable into a buffer */
+ expand_tilder(newdir); /* if a ~ string expand the tilde */
+@@ -84,9 +98,15 @@ change_dir(dir)
+ if( chdir(newdir) == 0 ) { /* if success */
+
+ /* get the full path of the new directory */
++#ifdef NAME_MAX
++ (void) getcwd(newdir, NAME_MAX);
++ if( strcmp(newdir,"/") != 0 )
++ (void) strncat(newdir, "/", NAME_MAX);
++#else
+ (void) getcwd(newdir, MAXNAMLEN);
+ if( strcmp(newdir,"/") != 0 )
+ (void) strncat(newdir, "/", MAXNAMLEN);
++#endif
+
+ /* did we actually change directory */
+ if( strcmp(dir_name, newdir) != 0 ) {
+@@ -148,8 +168,13 @@ user_ok(widget, client_data, call_data )
+ XtPointer client_data, call_data;
+ {
+ if ( user_input ) {
++#ifdef NAME_MAX
++ strncpy(input, XawDialogGetValueString(user_dialog), NAME_MAX);
++ input[NAME_MAX-1] = '\0'; /* just in case */
++#else
+ strncpy(input, XawDialogGetValueString(user_dialog), MAXNAMLEN);
+ input[MAXNAMLEN-1] = '\0'; /* just in case */
++#endif
+ }
+
+ /* expand string is first non-space char is a ~ */