SCCS-vsn: usr.bin/man/man.c 5.25
SCCS-vsn: usr.bin/man/config.c 5.7
-static char sccsid[] = "@(#)config.c 5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)config.c 5.7 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
-char *add1, *add2;
-register size_t len1;
+ char *add1, *add2;
+ register size_t len1;
{
static size_t buflen;
static char *bp, *endp;
register size_t len2;
len2 = add2 ? strlen(add2) : 0;
{
static size_t buflen;
static char *bp, *endp;
register size_t len2;
len2 = add2 ? strlen(add2) : 0;
- if (!bp || bp + len1 + len2 + 2 >= endp) {
- if (!(pathbuf = realloc(pathbuf, buflen += 1024)))
+ if (bp == NULL || bp + len1 + len2 + 2 >= endp) {
+ buflen += MAX(len1 + len2 + 2, 1024);
+ if ((pathbuf = realloc(pathbuf, buflen)) == NULL)
- if (!bp)
- bp = pathbuf;
- endp = pathbuf + buflen;
+ endp = (bp = pathbuf) + buflen;
}
bcopy(add1, bp, len1);
bp += len1;
}
bcopy(add1, bp, len1);
bp += len1;
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)man.c 5.24 (Berkeley) %G%";
+static char sccsid[] = "@(#)man.c 5.25 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
tmp = strtok(p_path, ":");
while (tmp) {
tmp = strtok(p_path, ":");
while (tmp) {
- (void)sprintf(buf, "%s/", tmp);
+ (void)snprintf(buf, sizeof(buf), "%s/", tmp);
for (av = arorder; *av; ++av)
cadd(buf, strlen(buf), *av);
for (av = arorder; *av; ++av)
cadd(buf, strlen(buf), *av);
- tmp = strtok((char *)NULL, ":");
+ tmp = strtok(NULL, ":");
}
p_path = pathbuf;
} else if (!(p_path = getpath(section)) && !p_augment) {
}
p_path = pathbuf;
} else if (!(p_path = getpath(section)) && !p_augment) {