提交 19b2720e 编写于 作者: C chegar

7022269: clean up fscanf usage in Linux networking native code

Reviewed-by: michaelm, alanb
上级 47a4bc28
......@@ -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];
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册