mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
maint: s/strncpy/memcpy/, when equivalent
* src/output.c (output_skeleton): Use memcpy, not strncpy, since the source is known to fit in the destination buffer. * src/parse-gram.y (%skeleton): Likewise.
This commit is contained in:
@@ -512,7 +512,7 @@ output_skeleton (void)
|
||||
full_skeleton = xmalloc (pkgdatadirlen + 1
|
||||
+ (skeleton_size < sizeof m4sugar
|
||||
? sizeof m4sugar : skeleton_size));
|
||||
strncpy (full_skeleton, pkgdatadir, pkgdatadirlen);
|
||||
memcpy (full_skeleton, pkgdatadir, pkgdatadirlen);
|
||||
full_skeleton[pkgdatadirlen] = '/';
|
||||
strcpy (full_skeleton + pkgdatadirlen + 1, m4sugar);
|
||||
full_m4sugar = xstrdup (full_skeleton);
|
||||
|
||||
@@ -322,7 +322,7 @@ prologue_declaration:
|
||||
xmalloc (dir_length + 1 + strlen (skeleton_user) + 1);
|
||||
if (dir_length > 0)
|
||||
{
|
||||
strncpy (skeleton_build, current_file, dir_length);
|
||||
memcpy (skeleton_build, current_file, dir_length);
|
||||
skeleton_build[dir_length++] = '/';
|
||||
}
|
||||
strcpy (skeleton_build + dir_length, skeleton_user);
|
||||
|
||||
Reference in New Issue
Block a user