summaryrefslogtreecommitdiff
blob: 8f2676c0c2b7d1e01414940826699f454b72e14f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/tree.c b/src/tree.c
index 7e8f665..89ad0d5 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -586,7 +586,7 @@ static void LoadChar( char *buf, int buf_len, uint16 phoneSeq[], int nPhoneSeq )
 	memset(buf, 0, buf_len);
 	for ( i = 0; i < nPhoneSeq; i++ ) {
 		GetCharFirst( &word, phoneSeq[ i ] );
-		strncat(buf, word.word, buf_len);
+		strncat(buf, word.word, buf_len - strlen(buf) - 1);
 	}
 	buf[ buf_len - 1 ] = '\0';
 }