Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/chewingio.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ CHEWING_API ChewingContext *chewing_new2(const char *syspath,
chewing_Reset(ctx);

if (syspath) {
strncpy(search_path, syspath, sizeof(search_path) - 1);
strncpy(search_path, syspath, ARRAY_SIZE(search_path) - 1);
} else {
ret = get_search_path(search_path, sizeof(search_path));
if (ret) {
Expand Down
4 changes: 2 additions & 2 deletions src/chewingutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static int _Inner_InternalSpecialSymbol(int key, ChewingData *pgdata, char symke
&pgdata->preeditBuf[pgdata->chiSymbolCursor],
sizeof(pgdata->preeditBuf[0]) * (pgdata->chiSymbolBufLen - pgdata->chiSymbolCursor));

strncpy(buf->char_, chibuf, sizeof(buf->char_) - 1);
strncpy(buf->char_, chibuf, ARRAY_SIZE(buf->char_) - 1);
buf->category = CHEWING_SYMBOL;

/* Save Symbol Key */
Expand Down Expand Up @@ -356,7 +356,7 @@ int SymbolChoice(ChewingData *pgdata, int sel_i)
symbol_type = SYMBOL_CHOICE_UPDATE;
}
}
strncpy(buf->char_, pgdata->choiceInfo.totalChoiceStr[sel_i], sizeof(buf->char_) - 1);
strncpy(buf->char_, pgdata->choiceInfo.totalChoiceStr[sel_i], ARRAY_SIZE(buf->char_) - 1);
buf->category = CHEWING_SYMBOL;

/* This is very strange */
Expand Down
2 changes: 1 addition & 1 deletion src/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ int InitUserphrase(struct ChewingData *pgdata, const char *path)
int item_index, hashvalue, iret, fsize, hdrlen, oldest = INT_MAX;
char *dump, *seekdump;

strncpy(pgdata->static_data.hashfilename, path, sizeof(pgdata->static_data.hashfilename));
strncpy(pgdata->static_data.hashfilename, path, ARRAY_SIZE(pgdata->static_data.hashfilename) - 1);
memset(pgdata->static_data.hashtable, 0, sizeof(pgdata->static_data.hashtable));

open_hash_file:
Expand Down