svnno****@sourc*****
svnno****@sourc*****
2009年 5月 14日 (木) 13:37:56 JST
Revision: 123 http://svn.sourceforge.jp/view?root=swfed&view=rev&rev=123 Author: yoya Date: 2009-05-14 13:37:56 +0900 (Thu, 14 May 2009) Log Message: ----------- getEditString で正しい長さの文字列を取得できない問題の修正 (変数名より長い文字列だと途中で切れていました) Modified Paths: -------------- trunk/src/swf_tag_edit.c -------------- next part -------------- Modified: trunk/src/swf_tag_edit.c =================================================================== --- trunk/src/swf_tag_edit.c 2009-03-11 16:36:36 UTC (rev 122) +++ trunk/src/swf_tag_edit.c 2009-05-14 04:37:56 UTC (rev 123) @@ -258,18 +258,20 @@ char *variable_name, int variable_name_len) { swf_tag_edit_detail_t *swf_tag_edit = (swf_tag_edit_detail_t *) detail; char *data, *initial_text; + int initial_text_len = 0; if (strcmp(swf_tag_edit->edit_variable_name, variable_name)) { if (atoi(variable_name) != swf_tag_edit->edit_id) { return NULL; } } initial_text = swf_tag_edit->edit_initial_text; - data = malloc(variable_name_len + 1); + initial_text_len = strlen(initial_text); + data = malloc(initial_text_len + 1); if (data == NULL) { fprintf(stderr, "swf_tag_edit_get_string: Can't malloc\n"); return NULL; } - memcpy(data, initial_text, variable_name_len + 1); + memcpy(data, initial_text, initial_text_len + 1); return data; }