diff options
author | eivind <eivind@FreeBSD.org> | 1997-12-12 18:11:29 +0000 |
---|---|---|
committer | eivind <eivind@FreeBSD.org> | 1997-12-12 18:11:29 +0000 |
commit | 1294d81731e72327a9b1ad2d12e20cadf68ec773 (patch) | |
tree | 3c2a0ec659bd827a9a092808cbb72b12a648e5ae /bin/stty | |
parent | 99e73a26e809af6c7debbfb64918e132c7dbb719 (diff) | |
download | FreeBSD-src-1294d81731e72327a9b1ad2d12e20cadf68ec773.zip FreeBSD-src-1294d81731e72327a9b1ad2d12e20cadf68ec773.tar.gz |
Merge from OpenBSD:
>sprintf -> snprintf paranoia
Obtainted from: OpenBSD src/bin/stty/print.c v1.5
by Todd Miller <millert@openbsd.org>
Diffstat (limited to 'bin/stty')
-rw-r--r-- | bin/stty/print.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/stty/print.c b/bin/stty/print.c index 339a203..21eb853 100644 --- a/bin/stty/print.c +++ b/bin/stty/print.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: print.c,v 1.8 1997/02/22 14:05:53 peter Exp $ */ #ifndef lint @@ -205,8 +205,10 @@ print(tp, wp, ldisc, fmt) if (fmt != BSD && cc[p->sub] == p->def) continue; #define WD "%-8s" - (void)sprintf(buf1 + cnt * 8, WD, p->name); - (void)sprintf(buf2 + cnt * 8, WD, ccval(p, cc[p->sub])); + (void)snprintf(buf1 + cnt * 8, sizeof(buf1) - cnt * 8, + WD, p->name); + (void)snprintf(buf2 + cnt * 8, sizeof(buf2) - cnt * 8, + WD, ccval(p, cc[p->sub])); if (++cnt == LINELENGTH / 8) { cnt = 0; (void)printf("%s\n", buf1); |