diff options
author | Choe Hwanjin <choe.hwanjin@gmail.com> | 2018-06-05 19:13:56 +0900 |
---|---|---|
committer | Choe Hwanjin <choe.hwanjin@gmail.com> | 2018-06-05 19:13:56 +0900 |
commit | 17577aedf1a123534f2d29df239f4250d71579b5 (patch) | |
tree | 717aca96609b8fca6444a37ece0588193457ceee | |
parent | a4c5f1e052650c7839a9667a5431ae437b217e03 (diff) | |
download | libhangul-17577aedf1a123534f2d29df239f4250d71579b5.tar.gz |
hangul_combination_set_data()에서 size_t overflow 문제 수정
대부분의 경우 ULONG_MAX는 SIZE_MAX와 같은 값을 가지겠지만,
size_t 타입에 맞는 최대값을 사용하는 편이 안전할 것이다.
https://github.com/choehwanjin/libhangul/issues/17
-rw-r--r-- | hangul/hangulkeyboard.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hangul/hangulkeyboard.c b/hangul/hangulkeyboard.c index fbb1822..65035d5 100644 --- a/hangul/hangulkeyboard.c +++ b/hangul/hangulkeyboard.c @@ -275,7 +275,7 @@ hangul_combination_set_data(HangulCombination* combination, if (combination == NULL) return false; - if (n == 0 || n > ULONG_MAX / sizeof(HangulCombinationItem)) + if (n == 0 || n > SIZE_MAX / sizeof(HangulCombinationItem)) return false; combination->table = malloc(sizeof(HangulCombinationItem) * n); |