 |
The TinTin++ message board
|
 |
| View previous topic :: View next topic |
| Author |
Message |
fog_proxy
Joined: 18 Oct 2005 Posts: 16
|
Posted: Mon Oct 31, 2005 3:35 am Post subject: bugs of BIG5 lines parser |
|
|
Well,I found there are two bugs when tintin++ parser the big5 characters with unreassemble telnet packets.
1.
For example,if a mud line send from telnet server looks like:
packet 1:
aaaaaabbbbbbbb...0xff
packet 2:
0xf9
here 0xff0xf9 should be a telnet command(GA),but in function translate_telopts(),there are no handles of this case.
2.
just the check of big5 characters not right.(please see my patch)
--------------------------------------------------------------------------------------------------------
| Code: |
--- tt-org/src/telopt.c 2005-09-30 19:04:32.000000000 +0800
+++ tt-new/src/telopt.c 2005-10-31 16:08:50.445929960 +0800
@@ -115,6 +115,9 @@
int skip, cnt;
unsigned char *cpdst;
unsigned char *cpsrc;
+#ifdef YTIN_EX
+ int IAC_pending = FALSE;
+#endif
if (cplen == 0)
{
@@ -181,11 +184,33 @@
cpdst = (unsigned char *) gtd->mud_output_buf + gtd->mud_output_len;
- while (cplen > 0)
+#ifdef YTIN_EX
+ if(IAC_pending)
{
+ gtd->mud_output_buf[gtd->mud_output_len] = IAC;
+ gtd->mud_output_len++;
+ gtd->mud_output_buf[gtd->mud_output_len] = 0;
+ IAC_pending = FALSE;
+ }
+#endif
+ while (cplen > 0)
+ {
if (*cpsrc == IAC)
{
+#ifdef YTIN_EX
+ if(cplen < 2)
+ {
+ /*
+ * Not enough space for telnet command,it should be
+ * continued
+ */
+ IAC_pending = TRUE;
+ skip = 1;
+ }
+ else
+ {
+#endif
if (HAS_BIT(ses->flags, SES_FLAG_DEBUGTELNET))
{
switch(cpsrc[1])
@@ -288,6 +313,9 @@
skip = 1;
break;
}
+#ifdef YTIN_EX
+ }
+#endif
cplen -= skip;
cpsrc += skip;
}
@@ -297,8 +325,11 @@
*cpdst++ = *cpsrc++;
gtd->mud_output_len++;
cplen--;
-
+#ifdef YTIN_EX
+ if ((*cpsrc)&&(cplen > 0))
+#else
if (*cpsrc)
+#endif
{
*cpdst++ = *cpsrc++;
gtd->mud_output_len++;
|
|
|
| Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Mon Oct 31, 2005 6:00 am Post subject: Re: bugs of BIG5 lines parser |
|
|
| fog_proxy wrote: | | here 0xff0xf9 should be a telnet command(GA),but in function translate_telopts(),there are no handles of this case. |
It's probably a better idea if I move the packet patch code from rl.c to telopt.c. That way larger telopts are dealt with as well. Sorry for being picky, but I do appreciate the effort.
| Quote: |
just the check of big5 characters not right.(please see my patch)
|
I see, I'll take care of that. |
|
| Back to top |
|
 |
fog_proxy
Joined: 18 Oct 2005 Posts: 16
|
Posted: Mon Oct 31, 2005 6:55 am Post subject: |
|
|
"from rl.c to telopt.c" or "from telopt.c to rl.c"?Anyway,will be glad to see a new version,I just modified for provisionally use  |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
TinTin++ Homepage
Powered by phpBB © 2001, 2002 phpBB Group
|