Skip to content

Commit

Permalink
fix stack overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
weltling committed Oct 10, 2015
1 parent fe67696 commit 4224907
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions TSRM/tsrm_win32.c
Expand Up @@ -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);
Expand Down

0 comments on commit 4224907

Please sign in to comment.