Skip to content

Commit 252c0c9

Browse files
authored
win32: switch handful of memmove over memcpy. (#17508)
1 parent 709c0a9 commit 252c0c9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

win32/ioutil.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ PW32IO int php_win32_ioutil_mkdir_w(const wchar_t *path, mode_t mode)
316316
SET_ERRNO_FROM_WIN32_CODE(ERROR_NOT_ENOUGH_MEMORY);
317317
return -1;
318318
}
319-
memmove(tmp, path, (path_len + 1) * sizeof(wchar_t));
319+
memcpy(tmp, path, (path_len + 1) * sizeof(wchar_t));
320320

321321
if (PHP_WIN32_IOUTIL_NORM_FAIL == php_win32_ioutil_normalize_path_w(&tmp, path_len, &path_len)) {
322322
free(tmp);
@@ -331,7 +331,7 @@ PW32IO int php_win32_ioutil_mkdir_w(const wchar_t *path, mode_t mode)
331331
free(tmp);
332332
return -1;
333333
}
334-
memmove(_tmp, PHP_WIN32_IOUTIL_LONG_PATH_PREFIXW, PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW * sizeof(wchar_t));
334+
memcpy(_tmp, PHP_WIN32_IOUTIL_LONG_PATH_PREFIXW, PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW * sizeof(wchar_t));
335335
src = tmp;
336336
dst = _tmp + PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW;
337337
#ifndef ZTS

win32/ioutil.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,11 @@ zend_always_inline static wchar_t *php_win32_ioutil_conv_any_to_w(const char* in
220220
}
221221

222222
if (PHP_WIN32_IOUTIL_IS_LONG_PATHW(mb, mb_len) || PHP_WIN32_IOUTIL_IS_JUNCTION_PATHW(mb, mb_len) || PHP_WIN32_IOUTIL_IS_UNC_PATHW(mb, mb_len)) {
223-
memmove(ret, mb, mb_len * sizeof(wchar_t));
223+
memcpy(ret, mb, mb_len * sizeof(wchar_t));
224224
ret[mb_len] = L'\0';
225225
} else {
226226
wchar_t *src = mb, *dst = ret + PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW;
227-
memmove(ret, PHP_WIN32_IOUTIL_LONG_PATH_PREFIXW, PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW * sizeof(wchar_t));
227+
memcpy(ret, PHP_WIN32_IOUTIL_LONG_PATH_PREFIXW, PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW * sizeof(wchar_t));
228228
#ifndef ZTS
229229
if (dir_len > 0) {
230230
size_t len = GetCurrentDirectoryW(dir_len, dst);

0 commit comments

Comments
 (0)