<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=iso-8859-1>
<META content="MSHTML 6.00.2900.5803" name=GENERATOR></HEAD>
<BODY id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px" leftMargin=0
topMargin=0 CanvasTabStop="true" name="Compose message area">
<DIV><FONT face=宋体>Dear all,</FONT></DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体>I think I have spotted a bug in libss7 code, I hope somebody
will check it.</FONT></DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体>SVN Rev.: 266<BR>Source file:
mtp2.c<BR>Lines: 646-652<BR>Snippet of the buggy codes are reproduced
below:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体>static int lssu_rx(struct mtp2 *link, struct mtp_su_head *h,
int len)<BR>{<BR> unsigned char lssutype = lssu_type(h);</FONT></DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体> if (len > (LSSU_SIZE + 2)) /* FCS is two bytes
*/<BR> mtp_error(link->master, "Received LSSU with length %d
longer than expected\n", len);</FONT></DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT
face=宋体>*************************************Separator**********************************</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体>Because LSSU_SIZE is #defined to be 6, the if statement in
the code above translates to:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体>if (len > (6 + 2))<BR>
mtp_error(link->master, "Received LSSU with length %d longer than
expected\n", len);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体>but LSSU is of fixed length (6 octets), so it's a bug! The
above codes will fail to issue a warning message when an erroneous LSSU with
length 7 of 8 is received.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体>
8 7 6
5 4 3
2 1<BR>
+-----+-----+-----+-----+-----+-----+-----+-----+<BR>
1 | BIB
|
BSN
|<BR>
+-----+-----+-----+-----+-----+-----+-----+-----+<BR>
2 | FIB
|
FSN
|<BR>
+-----+-----+-----+-----+-----+-----+-----+-----+<BR>
3
|///spare///|
LI = 1 or 2
|<BR>
|-----+-----+-----+-----+-----+-----+-----+-----+<BR>
4 |////////////spare////////////|
LSI
|<BR>
+-----+-----+-----+-----+-----+-----+-----+-----+<BR>
5
|
|<BR>
+---
CK
--+<BR> 6
|
|<BR>
+-----+-----+-----+-----+-----+-----+-----+-----+<BR>
format of an LSSU</FONT></DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体></FONT> </DIV>
<DIV><FONT face=宋体>Regards!</FONT></DIV></BODY></HTML>