From f09bbe38ff44db8c2f184f3a42ae03e021e9e1db Mon Sep 17 00:00:00 2001 From: deraadt Date: Sun, 6 Apr 2003 23:38:06 +0000 Subject: more strlcpy/strlcat/snprintf, less strcpy/strcat/sprintf reviewed by tdeval, millert, dhartmei and others. more bits coming here from some of them i think --- usr.bin/less/regexp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'usr.bin/less/regexp.c') diff --git a/usr.bin/less/regexp.c b/usr.bin/less/regexp.c index 3313855de45..65863bdc97c 100644 --- a/usr.bin/less/regexp.c +++ b/usr.bin/less/regexp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: regexp.c,v 1.5 2003/04/06 18:42:57 deraadt Exp $ */ +/* $OpenBSD: regexp.c,v 1.6 2003/04/06 23:38:07 deraadt Exp $ */ /* * regcomp and regexec -- regsub and regerror are elsewhere @@ -1166,7 +1166,8 @@ char *op; case OPEN+7: case OPEN+8: case OPEN+9: - sprintf(buf+strlen(buf), "OPEN%d", OP(op)-OPEN); + snprintf(buf+strlen(buf), sizeof buf - strlen(buf), + "OPEN%d", OP(op)-OPEN); p = NULL; break; case CLOSE+1: @@ -1178,7 +1179,8 @@ char *op; case CLOSE+7: case CLOSE+8: case CLOSE+9: - sprintf(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE); + snprintf(buf+strlen(buf), sizeof buf - strlen(buf), + "CLOSE%d", OP(op)-CLOSE); p = NULL; break; case STAR: -- cgit v1.2.3-59-g8ed1b