setWindowTitleFormat: fix buffer overrun
[nedit-bw.git] / dictionary-fix-string-alloc.patch
blob4e14299bf878e32065249b99ca7e5b0a975245e9
1 Subject: remove double allocation in dictionary patch
3 ---
5 source/macro.c | 5 -----
6 1 file changed, 5 deletions(-)
8 diff --quilt old/source/macro.c new/source/macro.c
9 --- old/source/macro.c
10 +++ new/source/macro.c
11 @@ -5845,7 +5845,6 @@ static int dictsaveMS(WindowInfo *window
14 result->tag = STRING_TAG;
15 - AllocNString(&result->val.str, strlen(dictionary_filename)+1);
16 AllocNStringCpy(&result->val.str, dictionary_filename);
18 return True;
19 @@ -5938,21 +5937,17 @@ static int dictcompleteMS(WindowInfo *wi
20 items_left = complete_dict(string, s2, minchars, maxmatches); /* so invoke a new search */
22 if (items_left <= 0) {
23 - AllocNString(&result->val.str, 1);
24 AllocNStringCpy(&result->val.str, "");
25 items_left = 0;
26 } else {
27 items_left--;
28 - AllocNString(&result->val.str, strlen(s2[items_left])+1);
29 AllocNStringCpy(&result->val.str, s2[items_left]);
31 } else { /* An empty key string was given, but maybe there are still some matches left from last call */
32 if (items_left > 0) {
33 items_left--;
34 - AllocNString(&result->val.str, strlen(s2[items_left])+1);
35 AllocNStringCpy(&result->val.str, s2[items_left]);
36 } else {
37 - AllocNString(&result->val.str, 1);
38 AllocNStringCpy(&result->val.str, "");
39 items_left = 0;