summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2019-04-29 18:18:51 +0300
committerEli Zaretskii <eliz@gnu.org>2019-04-29 18:18:51 +0300
commit3c513f3f62b1b4b425cdbabcbb8cc72c49478e6a (patch)
tree108d536a8bf637323075da250c343003ebbf2bd5 /src
parent74712470fcb95cd4ef6ef5c61eee73cb8e02a8bd (diff)
downloademacs-3c513f3f62b1b4b425cdbabcbb8cc72c49478e6a.tar.gz
Avoid compilation warnings in w32.c
* src/w32.c (unsetenv, readlink): Use memcpy instead of strncpy, to avoid a compiler warning about calculating the bound of the copy.
Diffstat (limited to 'src')
-rw-r--r--src/w32.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/w32.c b/src/w32.c
index 082a66b7384..677c37fcb5d 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -2644,7 +2644,7 @@ unsetenv (const char *name)
/* It is safe to use 'alloca' with 32K size, since the stack is at
least 2MB, and we set it to 8MB in the link command line. */
var = alloca (name_len + 2);
- strncpy (var, name, name_len);
+ memcpy (var, name, name_len);
var[name_len++] = '=';
var[name_len] = '\0';
return _putenv (var);
@@ -6054,7 +6054,7 @@ readlink (const char *name, char *buf, size_t buf_size)
lname_size = strlen (resolved) + 1;
if (lname_size <= buf_size)
size_to_copy = lname_size;
- strncpy (buf, resolved, size_to_copy);
+ memcpy (buf, resolved, size_to_copy);
/* Success! */
retval = size_to_copy;
}