Skip to content

Commit 322b88e

Browse files
author
Paul Gofman
committed
nsiproxy.sys: Fix ipv6 route table parsing on Linux.
CW-Bug-Id: #23640
1 parent 6861e8c commit 322b88e

File tree

1 file changed

+6
-5
lines changed
  • dlls/nsiproxy.sys

1 file changed

+6
-5
lines changed

dlls/nsiproxy.sys/ip.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,7 +1544,7 @@ struct in6_addr str_to_in6_addr(char *nptr, char **endptr)
15441544

15451545
for (int i = 0; i < sizeof(ret); i++)
15461546
{
1547-
if (!isxdigit( *nptr ) || !isxdigit( *nptr + 1 ))
1547+
if (!isxdigit( *nptr ) || !isxdigit( *(nptr + 1) ))
15481548
{
15491549
/* invalid hex string */
15501550
if (endptr) *endptr = nptr;
@@ -1574,17 +1574,14 @@ static NTSTATUS ipv6_forward_enumerate_all( void *key_data, UINT key_size, void
15741574

15751575
#ifdef __linux__
15761576
{
1577-
char buf[512], *ptr;
1577+
char buf[512], *ptr, *end;
15781578
UINT rtf_flags;
15791579
FILE *fp;
15801580

15811581
if (!(fp = fopen( "/proc/net/ipv6_route", "r" ))) return STATUS_NOT_SUPPORTED;
15821582

15831583
while ((ptr = fgets( buf, sizeof(buf), fp )))
15841584
{
1585-
while (!isspace( *ptr )) ptr++;
1586-
*ptr++ = '\0';
1587-
15881585
entry.prefix = str_to_in6_addr( ptr, &ptr );
15891586
entry.prefix_len = strtoul( ptr + 1, &ptr, 16 );
15901587
str_to_in6_addr( ptr + 1, &ptr ); /* source network, skip */
@@ -1597,6 +1594,10 @@ static NTSTATUS ipv6_forward_enumerate_all( void *key_data, UINT key_size, void
15971594
entry.protocol = (rtf_flags & RTF_GATEWAY) ? MIB_IPPROTO_NETMGMT : MIB_IPPROTO_LOCAL;
15981595
entry.loopback = entry.protocol == MIB_IPPROTO_LOCAL && entry.prefix_len == 32;
15991596

1597+
while (isspace( *ptr )) ptr++;
1598+
end = ptr;
1599+
while (*end && !isspace(*end)) ++end;
1600+
*end = 0;
16001601
if (!convert_unix_name_to_luid( ptr, &entry.luid )) continue;
16011602
if (!convert_luid_to_index( &entry.luid, &entry.if_index )) continue;
16021603

0 commit comments

Comments
 (0)