head	1.5;
access;
symbols
	RELEASE_7_4_0:1.4
	RELEASE_8_2_0:1.4
	RELEASE_6_EOL:1.4
	RELEASE_8_1_0:1.4
	RELEASE_7_3_0:1.4
	RELEASE_8_0_0:1.4
	RELEASE_7_2_0:1.4
	RELEASE_7_1_0:1.4
	RELEASE_6_4_0:1.4
	RELEASE_5_EOL:1.4
	RELEASE_7_0_0:1.4
	RELEASE_6_3_0:1.4
	PRE_XORG_7:1.4
	RELEASE_4_EOL:1.4
	RELEASE_6_2_0:1.4
	RELEASE_6_1_0:1.4
	RELEASE_5_5_0:1.4
	RELEASE_6_0_0:1.4
	RELEASE_5_4_0:1.4
	RELEASE_4_11_0:1.4
	RELEASE_5_3_0:1.4
	RELEASE_4_10_0:1.3
	RELEASE_5_2_1:1.3
	RELEASE_5_2_0:1.3
	RELEASE_4_9_0:1.3
	RELEASE_5_1_0:1.3
	RELEASE_4_8_0:1.3
	RELEASE_5_0_0:1.3
	RELEASE_4_7_0:1.3
	RELEASE_4_6_2:1.3
	RELEASE_4_6_1:1.3
	RELEASE_4_6_0:1.3
	RELEASE_5_0_DP1:1.3
	RELEASE_4_5_0:1.3
	RELEASE_4_4_0:1.1
	RELEASE_4_3_0:1.1
	RELEASE_4_2_0:1.1
	RELEASE_4_1_1:1.1
	RELEASE_4_1_0:1.1
	RELEASE_3_5_0:1.1
	RELEASE_4_0_0:1.1
	RELEASE_3_4_0:1.1;
locks; strict;
comment	@# @;


1.5
date	2011.05.02.09.11.33;	author bapt;	state dead;
branches;
next	1.4;

1.4
date	2004.06.10.02.17.34;	author ache;	state Exp;
branches;
next	1.3;

1.3
date	2001.11.30.06.24.58;	author ache;	state Exp;
branches;
next	1.2;

1.2
date	2001.11.28.10.52.30;	author ache;	state Exp;
branches;
next	1.1;

1.1
date	99.10.24.11.44.34;	author ache;	state Exp;
branches;
next	;


desc
@@


1.5
log
@Remove unmaintained expired ports from ftp

2011-05-01 ftp/axyftp: Upstream disapear and distfile is no more available
2011-05-01 ftp/emacs-wget: Upstream disapear and distfile is no more available
2011-05-01 ftp/llnlxdir: Upstream disapear and distfile is no more available
2011-05-01 ftp/llnlxftp: Upstream disapear and distfile is no more available
2011-05-01 ftp/mirror: Upstream disapear and distfile is no more available
2011-05-01 ftp/moftpd: Upstream disapear and distfile is no more available
2011-05-01 ftp/wu-ftpd: Upstream disapear and distfile is no more available
2011-05-01 ftp/xrmftp: Upstream disapear and distfile is no more available
2011-05-01 ftp/yale-tftpd: Upstream disapear and distfile is no more available
@
text
@--- src/glob.c.old	Thu Nov 29 20:01:38 2001
+++ src/glob.c	Thu Jun 10 06:13:51 2004
@@@@ -45,10 +45,12 @@@@
 
 #include "proto.h"
 
+#define ARGSIZ		(524288)
+
 #define	QUOTE 0200
 #define	TRIM 0177
 #define	eq(a,b)		(strcmp(a, b)==0)
-#define	GAVSIZ		(NCARGS/6)
+#define	GAVSIZ		(ARGSIZ/6)
 #define	isdir(d)	((d.st_mode & S_IFMT) == S_IFDIR)
 
 static char **gargv;		/* Pointer to the (stack) arglist */
@@@@ -112,7 +114,7 @@@@
 
     fixpath(v);
     if (v[0] == '\0')
-	v = "*";
+	v = ".";
     else if ((strlen(v) > 1) && (v[strlen(v) - 1] == '/'))
 	v[strlen(v) - 1] = '\0';
 
@@@@ -149,7 +151,7 @@@@
     gargv = agargv;
     sortbas = agargv;
     gargc = 0;
-    gnleft = NCARGS - 4;
+    gnleft = ARGSIZ - 4;
 }
 
 static void collect(register char *as)
@


1.4
log
@Increase args size for big listings

PR:             44019
Submitted by:   Cejka Rudolf <cejkar@@fit.vutbr.cz>
@
text
@@


1.3
log
@Use vendor-supplied prevent glob overflow patch
@
text
@d1 17
a17 3
--- src/glob.c.old	Sat Jul  1 22:17:39 2000
+++ src/glob.c	Wed Nov 28 13:42:26 2001
@@@@ -112,7 +118,7 @@@@
d26 9
@


1.2
log
@Prevent buffer overflow in glob
@
text
@a2 20
@@@@ -41,6 +41,7 @@@@
 #include <pwd.h>
 #include <errno.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include "proto.h"
@@@@ -48,6 +49,11 @@@@
 #define	QUOTE 0200
 #define	TRIM 0177
 #define	eq(a,b)		(strcmp(a, b)==0)
+
+#ifndef NCARGS
+#define NCARGS	20480		/* at least on SGI IRIX */
+#endif
+
 #define	GAVSIZ		(NCARGS/6)
 #define	isdir(d)	((d.st_mode & S_IFMT) == S_IFDIR)
 
a11 209
@@@@ -174,19 +180,21 @@@@
 	sort();
 }
 
+static int
+argcmp(const void *p1, const void *p2)
+{
+    char *s1 = *(char **) p1;
+    char *s2 = *(char **) p2;
+
+    return (strcmp(s1, s2));
+}
+
 static void sort(void)
 {
-    register char **p1, **p2, *c;
     char **Gvp = &gargv[gargc];
 
-    p1 = sortbas;
-    while (p1 < Gvp - 1) {
-	p2 = p1;
-	while (++p2 < Gvp)
-	    if (strcmp(*p1, *p2) > 0)
-		c = *p1, *p1 = *p2, *p2 = c;
-	p1++;
-    }
+    if (!globerr)
+	qsort(sortbas, Gvp - sortbas, sizeof (*sortbas), argcmp);
     sortbas = Gvp;
 }
 
@@@@ -292,13 +300,16 @@@@
 static int execbrc(char *p, char *s)
 {
     char restbuf[BUFSIZ + 2];
+    char *restbufend = &restbuf[sizeof(restbuf)];
     register char *pe, *pm, *pl;
     int brclev = 0;
     char *lm, savec, *sgpathp;
 
-    for (lm = restbuf; *p != '{'; *lm++ = *p++)
-	continue;
-    for (pe = ++p; *pe; pe++)
+    for (lm = restbuf; *p != '{'; *lm++ = *p++) {
+	if (lm >= restbufend)
+	    return (0);
+    }
+    for (pe = ++p; *pe; pe++) {
 	switch (*pe) {
 
 	case '{':
@@@@ -314,11 +325,19 @@@@
 	case '[':
 	    for (pe++; *pe && *pe != ']'; pe++)
 		continue;
+	    if (!*pe) {
+		globerr = "Missing ]";
+		return (0);
+	    }
 	    continue;
 	}
+    }
   pend:
-    brclev = 0;
-    for (pl = pm = p; pm <= pe; pm++)
+    if (brclev || !*pe) {
+	globerr = "Missing }";
+	return (0);
+    }
+    for (pl = pm = p; pm <= pe; pm++) {
 	switch (*pm & (QUOTE | TRIM)) {
 
 	case '{':
@@@@ -339,6 +358,8 @@@@
 	  doit:
 	    savec = *pm;
 	    *pm = 0;
+	    if (lm + strlen(pl) + strlen(pe + 1) >= restbufend)
+		return (0);
 	    (void) strcpy(lm, pl);
 	    (void) strcat(restbuf, pe + 1);
 	    *pm = savec;
@@@@ -352,19 +373,18 @@@@
 		return (1);
 	    sort();
 	    pl = pm + 1;
-	    if (brclev)
-		return (0);
 	    continue;
 
 	case '[':
 	    for (pm++; *pm && *pm != ']'; pm++)
 		continue;
-	    if (!*pm)
-		pm--;
+	    if (!*pm) {
+		globerr = "Missing ]";
+		return (0);
+	    }
 	    continue;
 	}
-    if (brclev)
-	goto doit;
+    }
     return (0);
 }
 
@@@@ -416,11 +436,10 @@@@
 		else if (scc == (lc = cc))
 		    ok++;
 	    }
-	    if (cc == 0)
-		if (ok)
-		    p--;
-		else
-		    return 0;
+	    if (cc == 0) {
+		globerr = "Missing ]";
+		return (0);
+	    }
 	    continue;
 
 	case '*':
@@@@ -473,73 +492,16 @@@@
     }
 }
 
-/* This function appears to be unused, so why waste time and space on it? */
-#if 0 == 1
-static int Gmatch(register char *s, register char *p)
-{
-    register int scc;
-    int ok, lc;
-    int c, cc;
-
-    for (;;) {
-	scc = *s++ & TRIM;
-	switch (c = *p++) {
-
-	case '[':
-	    ok = 0;
-	    lc = 077777;
-	    while (cc = *p++) {
-		if (cc == ']') {
-		    if (ok)
-			break;
-		    return (0);
-		}
-		if (cc == '-') {
-		    if (lc <= scc && scc <= *p++)
-			ok++;
-		}
-		else if (scc == (lc = cc))
-		    ok++;
-	    }
-	    if (cc == 0)
-		if (ok)
-		    p--;
-		else
-		    return 0;
-	    continue;
-
-	case '*':
-	    if (!*p)
-		return (1);
-	    for (s--; *s; s++)
-		if (Gmatch(s, p))
-		    return (1);
-	    return (0);
-
-	case 0:
-	    return (scc == 0);
-
-	default:
-	    if ((c & TRIM) != scc)
-		return (0);
-	    continue;
-
-	case '?':
-	    if (scc == 0)
-		return (0);
-	    continue;
-
-	}
-    }
-}
-#endif /* Gmatch exclusion */
-
 static void Gcat(register char *s1, register char *s2)
 {
     register size_t len = strlen(s1) + strlen(s2) + 1;
 
+    if (globerr)
+	return;
     if (len >= gnleft || gargc >= GAVSIZ - 1)
 	globerr = "Arguments too long";
+    else if (len > MAXPATHLEN)
+	globerr = "Pathname too long";
     else {
 	gargc++;
 	gnleft -= len;
@@@@ -620,6 +582,7 @@@@
 {
     register char **av = av0;
 
+    if (av)
     while (*av)
 	free(*av++);
 }
@


1.1
log
@Fix 'dir .' (works as dir *)

Submitted by:	Makoto MATSUSHITA <matusita@@jp.freebsd.org>
@
text
@d1 23
a23 3
--- src/glob.c.dist	Tue Oct  5 11:54:42 1999
+++ src/glob.c	Thu Oct 21 19:51:03 1999
@@@@ -107,7 +107,7 @@@@
d32 209
@

