File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,9 +47,10 @@ static char AX25_errmsg[128];
4747
4848extern struct aftype ax25_aftype ;
4949
50+ // align with NETROM_orint
5051static const char * AX25_print (const char * ptr )
5152{
52- static char buff [8 ];
53+ static char buff [10 ]; // N0CALL-15
5354 int i ;
5455
5556 for (i = 0 ; i < 6 ; i ++ ) {
@@ -58,9 +59,14 @@ static const char *AX25_print(const char *ptr)
5859 buff [i ] = '\0' ;
5960 }
6061 buff [6 ] = '\0' ;
62+
63+ // add SSID
6164 i = ((ptr [6 ] & 0x1E ) >> 1 );
62- if (i != 0 )
63- sprintf (& buff [strlen (buff )], "-%d" , i );
65+ if (i != 0 ) {
66+ int l = strlen (buff );
67+ sprintf (& buff [l ], sizeof (buff )- l , "-%d" , i );
68+ }
69+
6470 return (buff );
6571}
6672
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ extern struct aftype netrom_aftype;
5454
5555static const char * NETROM_print (const char * ptr )
5656{
57- static char buff [8 ];
57+ static char buff [10 ]; // N0CALL-15\0
5858 int i ;
5959
6060 for (i = 0 ; i < 6 ; i ++ ) {
@@ -63,9 +63,15 @@ static const char *NETROM_print(const char *ptr)
6363 buff [i ] = '\0' ;
6464 }
6565 buff [6 ] = '\0' ;
66+
67+ // add SSID
6668 i = ((ptr [6 ] & 0x1E ) >> 1 );
6769 if (i != 0 )
68- sprintf (& buff [strlen (buff )], "-%d" , i );
70+ {
71+ int l = strlen (buff ); // 0-6
72+ snprintf (& buff [l ],sizeof (buff )- l , "-%d" , i );
73+ }
74+
6975 return (buff );
7076}
7177
You can’t perform that action at this time.
0 commit comments