=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/man/Attic/man.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- src/usr.bin/man/Attic/man.c 2002/12/08 16:50:07 1.23 +++ src/usr.bin/man/Attic/man.c 2003/03/13 09:09:32 1.24 @@ -1,4 +1,4 @@ -/* $OpenBSD: man.c,v 1.23 2002/12/08 16:50:07 millert Exp $ */ +/* $OpenBSD: man.c,v 1.24 2003/03/13 09:09:32 deraadt Exp $ */ /* $NetBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $ */ /* @@ -44,7 +44,7 @@ #if 0 static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95"; #else -static char rcsid[] = "$OpenBSD: man.c,v 1.23 2002/12/08 16:50:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: man.c,v 1.24 2003/03/13 09:09:32 deraadt Exp $"; #endif #endif /* not lint */ @@ -696,6 +696,7 @@ check_pager(char *name) { char *p, *save; + int len; /* * if the user uses "more", we make it "more -s"; watch out for @@ -712,10 +713,10 @@ if (!strncmp(p, "more", 4) && (!p[4] || isspace(p[4]))){ save = name; /* allocate space to add the "-s" */ - if (!(name = - malloc(strlen(save) + 1 + sizeof("-s")))) + len = strlen(save) + 1 + sizeof("-s"); + if (!(name =malloc(len))) err(1, NULL); - (void)sprintf(name, "%s %s", save, "-s"); + (void)snprintf(name, len, "%s %s", save, "-s"); } return(name); }