diff options
| author | Eli Zaretskii | 2019-04-29 18:18:51 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-04-29 18:18:51 +0300 |
| commit | 3c513f3f62b1b4b425cdbabcbb8cc72c49478e6a (patch) | |
| tree | 108d536a8bf637323075da250c343003ebbf2bd5 /src | |
| parent | 74712470fcb95cd4ef6ef5c61eee73cb8e02a8bd (diff) | |
| download | emacs-3c513f3f62b1b4b425cdbabcbb8cc72c49478e6a.tar.gz emacs-3c513f3f62b1b4b425cdbabcbb8cc72c49478e6a.zip | |
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.c | 4 |
1 files changed, 2 insertions, 2 deletions
| @@ -2644,7 +2644,7 @@ unsetenv (const char *name) | |||
| 2644 | /* It is safe to use 'alloca' with 32K size, since the stack is at | 2644 | /* It is safe to use 'alloca' with 32K size, since the stack is at |
| 2645 | least 2MB, and we set it to 8MB in the link command line. */ | 2645 | least 2MB, and we set it to 8MB in the link command line. */ |
| 2646 | var = alloca (name_len + 2); | 2646 | var = alloca (name_len + 2); |
| 2647 | strncpy (var, name, name_len); | 2647 | memcpy (var, name, name_len); |
| 2648 | var[name_len++] = '='; | 2648 | var[name_len++] = '='; |
| 2649 | var[name_len] = '\0'; | 2649 | var[name_len] = '\0'; |
| 2650 | return _putenv (var); | 2650 | return _putenv (var); |
| @@ -6054,7 +6054,7 @@ readlink (const char *name, char *buf, size_t buf_size) | |||
| 6054 | lname_size = strlen (resolved) + 1; | 6054 | lname_size = strlen (resolved) + 1; |
| 6055 | if (lname_size <= buf_size) | 6055 | if (lname_size <= buf_size) |
| 6056 | size_to_copy = lname_size; | 6056 | size_to_copy = lname_size; |
| 6057 | strncpy (buf, resolved, size_to_copy); | 6057 | memcpy (buf, resolved, size_to_copy); |
| 6058 | /* Success! */ | 6058 | /* Success! */ |
| 6059 | retval = size_to_copy; | 6059 | retval = size_to_copy; |
| 6060 | } | 6060 | } |