summaryrefslogtreecommitdiffstats
path: root/src/appl/gssftp
diff options
context:
space:
mode:
Diffstat (limited to 'src/appl/gssftp')
-rw-r--r--src/appl/gssftp/ftp/ChangeLog6
-rw-r--r--src/appl/gssftp/ftp/glob.c10
2 files changed, 14 insertions, 2 deletions
diff --git a/src/appl/gssftp/ftp/ChangeLog b/src/appl/gssftp/ftp/ChangeLog
index 330a6beec4..fc15245dab 100644
--- a/src/appl/gssftp/ftp/ChangeLog
+++ b/src/appl/gssftp/ftp/ChangeLog
@@ -1,3 +1,9 @@
+2001-11-30 Tom Yu <tlyu@mit.edu>
+
+ * glob.c (execbrc): Fix some fencepost errors. Don't copy
+ uninitialized memory past the end of the pattern string. Don't
+ increment pointer beyond string end.
+
2001-10-10 Danilo Almeida <dalmeida@mit.edu>
* ftp.c: Conditionalize declarations of some "unused variables" to
diff --git a/src/appl/gssftp/ftp/glob.c b/src/appl/gssftp/ftp/glob.c
index b33de3a8f2..272e503056 100644
--- a/src/appl/gssftp/ftp/glob.c
+++ b/src/appl/gssftp/ftp/glob.c
@@ -338,6 +338,7 @@ execbrc(p, s)
for (lm = restbuf; *p != '{'; *lm++ = *p++)
continue;
+ /* pe starts pointing to one past the first '{'. */
for (pe = ++p; *pe; pe++)
switch (*pe) {
@@ -354,6 +355,8 @@ execbrc(p, s)
case '[':
for (pe++; *pe && *pe != ']'; pe++)
continue;
+ if (!*pe)
+ pe--;
continue;
}
pend:
@@ -366,7 +369,7 @@ pend:
continue;
case '}':
- if (brclev) {
+ if (brclev) { /* brclev = 0 is outermost brace set */
brclev--;
continue;
}
@@ -381,7 +384,10 @@ doit:
*pm = 0;
(void) strncpy(lm, pl, sizeof(restbuf) - 1 - (lm - restbuf));
restbuf[sizeof(restbuf) - 1] = '\0';
- (void) strncat(restbuf, pe + 1, sizeof(restbuf) - 1 - strlen(restbuf));
+ if (*pe) {
+ (void) strncat(restbuf, pe + 1,
+ sizeof(restbuf) - 1 - strlen(restbuf));
+ }
*pm = savec;
if (s == 0) {
sgpathp = gpathp;