diff options
author | Anatol Belski <ab@php.net> | 2015-09-22 21:12:05 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2015-10-10 18:37:16 +0200 |
commit | 4224907864bbc1291262447c4e23babd7f016fb3 (patch) | |
tree | 2edc75de0e6cb8883d4cc03d09a3b3e449fd6575 /TSRM/tsrm_win32.c | |
parent | fe676968671e52b144d0919deb70492103745e9b (diff) | |
download | php-git-4224907864bbc1291262447c4e23babd7f016fb3.tar.gz |
fix stack overflow
Diffstat (limited to 'TSRM/tsrm_win32.c')
-rw-r--r-- | TSRM/tsrm_win32.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c index 9f900f2ae6..e8ec18650a 100644 --- a/TSRM/tsrm_win32.c +++ b/TSRM/tsrm_win32.c @@ -599,8 +599,10 @@ TSRM_API int shmget(int key, int size, int flags) return -1; } - sprintf(shm_segment, "TSRM_SHM_SEGMENT:%d", key); - sprintf(shm_info, "TSRM_SHM_DESCRIPTOR:%d", key); + snprintf(shm_segment, sizeof(shm_segment)-1, "TSRM_SHM_SEGMENT:%d", key); + snprintf(shm_info, sizeof(shm_info)-1, "TSRM_SHM_DESCRIPTOR:%d", key); + shm_segment[sizeof(shm_segment)-1] = '\0'; + shm_info[sizeof(shm_info)-1] = '\0'; shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment); info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info); |