7022269: clean up fscanf usage in Linux networking native code

Reviewed-by: michaelm, alanb
This commit is contained in:
Chris Hegarty 2011-02-28 11:03:52 +00:00
parent cea2f39843
commit b989a55847
2 changed files with 5 additions and 5 deletions

View File

@ -1099,7 +1099,7 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) {
#ifdef AF_INET6
static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
FILE *f;
char addr6[40], devname[20];
char addr6[40], devname[21];
char addr6p[8][5];
int plen, scope, dad_status, if_idx;
uint8_t ipv6addr[16];

View File

@ -608,7 +608,7 @@ static void initLoopbackRoutes() {
{
/* now find the scope_id for "lo" */
char devname[20];
char devname[21];
char addr6p[8][5];
int plen, scope, dad_status, if_idx;
@ -651,7 +651,7 @@ static int nifs = 0; /* number of entries used in array */
static void initLocalIfs () {
FILE *f;
unsigned char staddr [16];
char ifname [32];
char ifname [33];
struct localinterface *lif=0;
int index, x1, x2, x3;
unsigned int u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,ua,ub,uc,ud,ue,uf;
@ -660,7 +660,7 @@ static void initLocalIfs () {
return ;
}
while (fscanf (f, "%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x "
"%d %x %x %x %s",&u0,&u1,&u2,&u3,&u4,&u5,&u6,&u7,
"%d %x %x %x %32s",&u0,&u1,&u2,&u3,&u4,&u5,&u6,&u7,
&u8,&u9,&ua,&ub,&uc,&ud,&ue,&uf,
&index, &x1, &x2, &x3, ifname) == 21) {
staddr[0] = (unsigned char)u0;
@ -1102,7 +1102,7 @@ int getDefaultIPv6Interface(struct in6_addr *target_addr) {
* index.
*/
if (match) {
char devname[20];
char devname[21];
char addr6p[8][5];
int plen, scope, dad_status, if_idx;