aboutsummaryrefslogtreecommitdiffstats
path: root/epan/osi-utils.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-05-15 18:58:15 +0000
committerGuy Harris <guy@alum.mit.edu>2001-05-15 18:58:15 +0000
commit951f325ecaf9f5c3d0a7a68b62011ffcec801901 (patch)
treedf589a21a4f05525977ecb6bf5dcdb9118fcc3cb /epan/osi-utils.c
parentdc710bd3df58af8594d38a26ee12386b96cba52e (diff)
Stop depending on the order in which operations are performed by
generated code, as per Chris Foulds' note. Also, when constructing the system ID or area string, always append the four-octet groups, rather than overwriting them, as we had been doing. svn path=/trunk/; revision=3414
Diffstat (limited to 'epan/osi-utils.c')
-rw-r--r--epan/osi-utils.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/epan/osi-utils.c b/epan/osi-utils.c
index 5c916ac9ad..47bb52c9f8 100644
--- a/epan/osi-utils.c
+++ b/epan/osi-utils.c
@@ -2,7 +2,7 @@
* Routines for ISO/OSI network and transport protocol packet disassembly
* Main entrance point and common functions
*
- * $Id: osi-utils.c,v 1.3 2001/04/16 10:04:33 guy Exp $
+ * $Id: osi-utils.c,v 1.4 2001/05/15 18:58:15 guy Exp $
* Laurent Deniel <deniel@worldnet.fr>
* Ralf Schneider <Ralf.Schneider@t-online.de>
*
@@ -86,7 +86,7 @@ gchar *print_system_id( const guint8 *buffer, int length ) {
cur = str;
if ( ( 6 == length ) || ( 7 == length ) ) { /* Special case, print as MAC */
- cur += sprintf(str, "%02x%02x.%02x%02x.%02x%02x", buffer[0], buffer[1],
+ cur += sprintf(cur, "%02x%02x.%02x%02x.%02x%02x", buffer[0], buffer[1],
buffer[2], buffer[3], buffer[4], buffer[5] );
if ( 7 == length ) {
sprintf( cur, "-%02x", buffer[6] );
@@ -95,8 +95,10 @@ gchar *print_system_id( const guint8 *buffer, int length ) {
else {
tmp = 0;
while ( tmp < length / 4 ) { /* 16 / 4 == 4 > four Octets left to print */
- cur += sprintf( str, "%02x%02x%02x%02x.", buffer[tmp++], buffer[tmp++],
- buffer[tmp++], buffer[tmp++] );
+ cur += sprintf( cur, "%02x", buffer[tmp++] );
+ cur += sprintf( cur, "%02x", buffer[tmp++] );
+ cur += sprintf( cur, "%02x", buffer[tmp++] );
+ cur += sprintf( cur, "%02x.", buffer[tmp++] );
}
if ( 1 == tmp ) { /* Special case for Designated IS */
sprintf( --cur, "-%02x", buffer[tmp] );
@@ -158,9 +160,11 @@ gchar *print_area(const guint8 *buffer, int length)
return( str );
}
if ( 4 < length ) {
- while ( tmp < length / 4 ) { /* 16/4==4 four Octets left to print */
- cur += sprintf( str, "%02x%02x%02x%02x.", buffer[tmp++], buffer[tmp++],
- buffer[tmp++], buffer[tmp++] );
+ while ( tmp < length / 4 ) { /* 16/4==4 > four Octets left to print */
+ cur += sprintf( cur, "%02x", buffer[tmp++] );
+ cur += sprintf( cur, "%02x", buffer[tmp++] );
+ cur += sprintf( cur, "%02x", buffer[tmp++] );
+ cur += sprintf( cur, "%02x.", buffer[tmp++] );
}
if ( 1 == tmp ) { /* Special case for Designated IS */
sprintf( --cur, "-%02x", buffer[tmp] );