Line 0
Link Here
|
|
|
1 |
Index: src/token.c |
2 |
=================================================================== |
3 |
RCS file: /cvsroot/bogofilter/bogofilter/src/token.c,v |
4 |
retrieving revision 1.153 |
5 |
retrieving revision 1.155 |
6 |
diff -u -r1.153 -r1.155 |
7 |
--- src/token.c 26 Nov 2006 16:34:30 -0000 1.153 |
8 |
+++ src/token.c 12 Jan 2007 00:20:16 -0000 1.155 |
9 |
@@ -1,4 +1,4 @@ |
10 |
-/* $Id: token.c,v 1.153 2006/11/26 16:34:30 relson Exp $ */ |
11 |
+/* $Id: token.c,v 1.155 2007/01/12 00:20:16 relson Exp $ */ |
12 |
|
13 |
/***************************************************************************** |
14 |
|
15 |
@@ -121,22 +121,17 @@ |
16 |
token_set(dst, src->text, src->leng); |
17 |
} |
18 |
|
19 |
-static void build_prefixed_token( word_t *token, word_t *prefix, |
20 |
+static void build_prefixed_token( word_t *prefix, word_t *token, |
21 |
word_t *temp, uint32_t temp_size ) |
22 |
{ |
23 |
- uint pfx_len = (prefix == NULL) ? 0 : prefix->leng; |
24 |
- uint len = token->leng + pfx_len; |
25 |
+ uint len = token->leng + prefix->leng; |
26 |
|
27 |
if (len >= temp_size) |
28 |
- len = temp_size - pfx_len - 1; |
29 |
+ len = temp_size - prefix->leng - 1; |
30 |
|
31 |
temp->leng = len; |
32 |
- |
33 |
- /* copy prefix, if there is one */ |
34 |
- if (prefix != NULL) |
35 |
- memcpy(temp->text, prefix->text, pfx_len); |
36 |
- |
37 |
- memcpy(temp->text + pfx_len, token->text, len-pfx_len); |
38 |
+ memmove(temp->text+prefix->leng, token->text, len-prefix->leng); |
39 |
+ memcpy(temp->text, prefix->text, prefix->leng); |
40 |
Z(temp->text[temp->leng]); |
41 |
|
42 |
token->leng = temp->leng; |
43 |
@@ -167,12 +162,11 @@ |
44 |
if (token_prefix != NULL) { |
45 |
/* IP addresses get special prefix */ |
46 |
if (save_class != IPADDR) { |
47 |
- build_prefixed_token(token, token_prefix, &yylval, yylval_text_size); |
48 |
+ build_prefixed_token(token_prefix, token, &yylval, yylval_text_size); |
49 |
} |
50 |
else { |
51 |
- |
52 |
word_t *prefix = (wordlist_version >= IP_PREFIX) ? w_ip : w_url; |
53 |
- build_prefixed_token(token, prefix, ipsave, max_token_len); |
54 |
+ build_prefixed_token(prefix, token, &yylval, yylval_text_size); |
55 |
} |
56 |
|
57 |
/* if excessive length caused by prefix, get another token */ |
58 |
@@ -198,7 +192,7 @@ |
59 |
else |
60 |
{ |
61 |
ipsave->leng = (uint) (t - ipsave->text); |
62 |
- token_set( &yylval, ipsave->text, ipsave->leng); |
63 |
+ token_set( token, ipsave->text, ipsave->leng); |
64 |
cls = save_class; |
65 |
done = true; |
66 |
} |