+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
for (lm = restbuf; *p != '{'; *lm++ = *p++)
continue;
+ /* pe starts pointing to one past the first '{'. */
for (pe = ++p; *pe; pe++)
switch (*pe) {
case '[':
for (pe++; *pe && *pe != ']'; pe++)
continue;
+ if (!*pe)
+ pe--;
continue;
}
pend:
continue;
case '}':
- if (brclev) {
+ if (brclev) { /* brclev = 0 is outermost brace set */
brclev--;
continue;
}
*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;