changeset 3824:29f25ba547fc

7022269: clean up fscanf usage in Linux networking native code Reviewed-by: michaelm, alanb
author chegar
date Mon, 28 Feb 2011 11:03:52 +0000
parents 8887cb2f5d19
children a3b6c262195b
files src/solaris/native/java/net/NetworkInterface.c src/solaris/native/java/net/net_util_md.c
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/java/net/NetworkInterface.c	Fri Feb 25 02:06:10 2011 -0800
+++ b/src/solaris/native/java/net/NetworkInterface.c	Mon Feb 28 11:03:52 2011 +0000
@@ -1099,7 +1099,7 @@
 #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];
--- a/src/solaris/native/java/net/net_util_md.c	Fri Feb 25 02:06:10 2011 -0800
+++ b/src/solaris/native/java/net/net_util_md.c	Mon Feb 28 11:03:52 2011 +0000
@@ -608,7 +608,7 @@
     {
         /* 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 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 @@
         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 @@
      * index.
      */
     if (match) {
-        char devname[20];
+        char devname[21];
         char addr6p[8][5];
         int plen, scope, dad_status, if_idx;