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/lsystem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'usr.bin/less/lsystem.c') diff --git a/usr.bin/less/lsystem.c b/usr.bin/less/lsystem.c index cda57942c5c..9e39a8ed1fe 100644 --- a/usr.bin/less/lsystem.c +++ b/usr.bin/less/lsystem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lsystem.c,v 1.3 2001/11/19 19:02:14 mpech Exp $ */ +/* $OpenBSD: lsystem.c,v 1.4 2003/04/06 23:38:07 deraadt Exp $ */ /* * Copyright (c) 1984,1985,1989,1994,1995 Mark Nudelman @@ -118,9 +118,9 @@ lsystem(cmd) p = save(shell); else { - p = (char *) ecalloc(strlen(shell) + strlen(cmd) + 7, - sizeof(char)); - sprintf(p, "%s -c \"%s\"", shell, cmd); + size_t l = strlen(shell) + strlen(cmd) + 7; + p = (char *) ecalloc(l, sizeof(char)); + snprintf(p, l, "%s -c \"%s\"", shell, cmd); } } if (p == NULL) -- cgit v1.2.3-59-g8ed1b