Commit 3c513f3f authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

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.
parent 74712470
Pipeline #1496 passed with stage
in 73 minutes and 25 seconds
......@@ -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;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment