]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(main): Use memcpy, not strcpy.
authorJim Meyering <jim@meyering.net>
Sun, 4 Jan 2004 21:00:49 +0000 (21:00 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 4 Jan 2004 21:00:49 +0000 (21:00 +0000)
src/fold.c

index 5d3b3d8977b2e3a95f0a54341b2424f1f91e17de..6f50f02b6f6b2459b693644fe0b05a477be86390 100644 (file)
@@ -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 ())
                {