From 45c0d30e1d196c6461a3645c698c1553f89b3eb7 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 4 Jan 2004 21:00:49 +0000 Subject: (main): Use memcpy, not strcpy. --- src/fold.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/fold.c b/src/fold.c index 5d3b3d897..6f50f02b6 100644 --- a/src/fold.c +++ b/src/fold.c @@ -1,5 +1,5 @@ /* fold -- wrap each input line to fit in specified width. - Copyright (C) 91, 1995-2003 Free Software Foundation, Inc. + Copyright (C) 91, 1995-2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -263,10 +263,11 @@ main (int argc, char **argv) break; if (ISDIGIT (a[1])) { - char *s = xmalloc (strlen (a) + 2); + size_t len_a = strlen (a); + char *s = xmalloc (len_a + 2); s[0] = '-'; s[1] = 'w'; - strcpy (s + 2, a + 1); + memcpy (s + 2, a + 1, len_a); argv[i] = s; if (200112 <= posix2_version ()) { -- cgit v1.2.3-70-g09d2