about summary refs log tree commit diff stats
path: root/src/LYSearch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/LYSearch.c')
-rw-r--r--src/LYSearch.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/LYSearch.c b/src/LYSearch.c
index 752ad488..252185f1 100644
--- a/src/LYSearch.c
+++ b/src/LYSearch.c
@@ -164,9 +164,10 @@ PRIVATE int check_for_target_in_links ARGS2(
  *
  */
 
-PUBLIC BOOL textsearch ARGS3(
+PUBLIC BOOL textsearch ARGS4(
 	document *,	cur_doc,
 	char *,		prev_target,
+	int,		target_size,
 	BOOL,		next)
 {
     int offset;
@@ -196,7 +197,7 @@ PUBLIC BOOL textsearch ARGS3(
 	 *  LYK_NEXT was pressed, so copy the
 	 *  buffer into prev_target. - FM
 	 */
-	strcpy(prev_target, prev_target_buffer);
+	LYstrncpy(prev_target, prev_target_buffer, target_size);
 
     if (strlen(prev_target) == 0 ) {
 	/*
@@ -207,13 +208,12 @@ PUBLIC BOOL textsearch ARGS3(
 	 */
 	_statusline(ENTER_WHEREIS_QUERY);
 
-	if ((ch = LYgetstr(prev_target, VISIBLE,
-			   sizeof(prev_target_buffer), recall)) < 0) {
+	if ((ch = LYgetstr(prev_target, VISIBLE, target_size, recall)) < 0) {
 	    /*
 	     *  User cancelled the search via ^G.
 	     *  Restore prev_target and return. - FM
 	     */
-	    strcpy(prev_target, prev_target_buffer);
+	    LYstrncpy(prev_target, prev_target_buffer, target_size);
 	    HTInfoMsg(CANCELLED);
 	    return(FALSE);
 	}
@@ -262,7 +262,7 @@ check_recall:
 	    QueryNum = 0;
 	if ((cp = (char *)HTList_objectAt(search_queries,
 					  QueryNum)) != NULL) {
-	    strcpy(prev_target, cp);
+	    LYstrncpy(prev_target, cp, target_size);
 	    if (*prev_target_buffer &&
 		!strcmp(prev_target_buffer, prev_target)) {
 		_statusline(EDIT_CURRENT_QUERY);
@@ -272,13 +272,12 @@ check_recall:
 	    } else {
 		_statusline(EDIT_A_PREV_QUERY);
 	    }
-	    if ((ch = LYgetstr(prev_target, VISIBLE,
-			       sizeof(prev_target_buffer), recall)) < 0) {
+	    if ((ch = LYgetstr(prev_target, VISIBLE, target_size, recall)) < 0) {
 		/*
 		 *  User canceled the search via ^G.
 		 *  Restore prev_target and return. - FM
 		 */
-		strcpy(prev_target, prev_target_buffer);
+		LYstrncpy(prev_target, prev_target_buffer, target_size);
 		HTInfoMsg(CANCELLED);
 		return(FALSE);
 	    }
@@ -314,7 +313,7 @@ check_recall:
 	    QueryNum = QueryTotal - 1;
 	if ((cp = (char *)HTList_objectAt(search_queries,
 					  QueryNum)) != NULL) {
-	    strcpy(prev_target, cp);
+	    LYstrncpy(prev_target, cp, target_size);
 	    if (*prev_target_buffer &&
 		!strcmp(prev_target_buffer, prev_target)) {
 		_statusline(EDIT_CURRENT_QUERY);
@@ -324,13 +323,12 @@ check_recall:
 	    } else {
 		_statusline(EDIT_A_PREV_QUERY);
 	    }
-	    if ((ch = LYgetstr(prev_target, VISIBLE,
-			       sizeof(prev_target_buffer), recall)) < 0) {
+	    if ((ch = LYgetstr(prev_target, VISIBLE, target_size, recall)) < 0) {
 		/*
 		 *  User cancelled the search via ^G.
 		 *  Restore prev_target and return. - FM
 		 */
-		strcpy(prev_target, prev_target_buffer);
+		LYstrncpy(prev_target, prev_target_buffer, target_size);
 		HTInfoMsg(CANCELLED);
 		return(FALSE);
 	    }
@@ -340,7 +338,7 @@ check_recall:
     /*
      *  Replace the search string buffer with the new target. - FM
      */
-    strcpy(prev_target_buffer, prev_target);
+    LYstrncpy(prev_target_buffer, prev_target, sizeof(prev_target_buffer)-1);
     HTAddSearchQuery(prev_target_buffer);
 
     /*
12:39:06 -0500 Add basic account widget, populate real acct views' href='/akspecs/aerc/commit/widgets/account.go?h=0.1.1&id=648ca983f6b2ef29378c32d1ebb6d67798f4af6d'>648ca98 ^
0f8b7a1 ^
ef6178a ^
0911cd5 ^
648ca98 ^

24dfc47 ^
589db74 ^
648ca98 ^


648ca98 ^
a729179 ^
648ca98 ^

b76deea ^
24dfc47 ^
b76deea ^
589db74 ^
c286d3d ^
589db74 ^



c286d3d ^
b76deea ^
0911cd5 ^
24dfc47 ^
589db74 ^
2349b7d ^
11f0a72 ^
0f8b7a1 ^

24dfc47 ^
589db74 ^








0911cd5 ^






24dfc47 ^
0911cd5 ^


24dfc47 ^

589db74 ^
0911cd5 ^
24dfc47 ^
0911cd5 ^

62946ff ^
24dfc47 ^
62946ff ^

607ece8 ^
1228448 ^


648ca98 ^
b76deea ^


648ca98 ^








c286d3d ^
589db74 ^

c286d3d ^
2349b7d ^



589db74 ^
cf66462 ^



77c76ba ^
cf66462 ^








589db74 ^
cf66462 ^
2349b7d ^

2349b7d ^



2349b7d ^

b60999c ^




24daef8 ^



b60999c ^
b389647 ^



4ec7f5d ^








b389647 ^

0f8b7a1 ^

b389647 ^





ef6178a ^
b389647 ^



77ede6e ^


b389647 ^


312a53e ^


b389647 ^

589db74 ^
b389647 ^

b60999c ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190