[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] Make sure fixed size CHAR arrays can fit MAX_ULONGs
When formatting strings with %u, make sure the target buffer is large enough to contain MAX_ULONG. Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> --- src/xenvif/fdo.c | 4 +++- src/xenvif/frontend.c | 8 ++++++-- src/xenvif/mac.c | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/xenvif/fdo.c b/src/xenvif/fdo.c index 00e0c8a..896107c 100644 --- a/src/xenvif/fdo.c +++ b/src/xenvif/fdo.c @@ -801,7 +801,7 @@ __FdoEnumerate( if (Device->Length != 0) { ULONG Number; - CHAR Prefix[sizeof ("device/vif/XX")]; + CHAR Prefix[sizeof ("device/vif/XXXXXXXXXX")]; PCHAR Address; Number = strtol(Device->Buffer, NULL, 10); @@ -811,6 +811,8 @@ __FdoEnumerate( "device/vif/%u", Number); ASSERT(NT_SUCCESS(status)); + if (!NT_SUCCESS(status)) + continue; status = XENBUS_STORE(Read, &Fdo->StoreInterface, diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c index 0ed68df..ffd6111 100644 --- a/src/xenvif/frontend.c +++ b/src/xenvif/frontend.c @@ -706,7 +706,7 @@ FrontendDumpAddressTable( switch (Frontend->AddressTable[Index].si_family) { case AF_INET: { IPV4_ADDRESS Address; - CHAR Node[sizeof ("ipv4/XXXXXXXX")]; + CHAR Node[sizeof ("ipv4/XXXXXXXXXX")]; RtlCopyMemory(Address.Byte, &Frontend->AddressTable[Index].Ipv4.sin_addr.s_addr, @@ -717,6 +717,8 @@ FrontendDumpAddressTable( "ipv4/%u", IpVersion4Count); ASSERT(NT_SUCCESS(status)); + if (!NT_SUCCESS(status)) + continue; status = XENBUS_STORE(Printf, &Frontend->StoreInterface, @@ -736,7 +738,7 @@ FrontendDumpAddressTable( } case AF_INET6: { IPV6_ADDRESS Address; - CHAR Node[sizeof ("ipv6/XXXXXXXX")]; + CHAR Node[sizeof ("ipv6/XXXXXXXXXX")]; RtlCopyMemory(Address.Byte, &Frontend->AddressTable[Index].Ipv6.sin6_addr.s6_addr, @@ -747,6 +749,8 @@ FrontendDumpAddressTable( "ipv6/%u", IpVersion6Count); ASSERT(NT_SUCCESS(status)); + if (!NT_SUCCESS(status)) + continue; status = XENBUS_STORE(Printf, &Frontend->StoreInterface, diff --git a/src/xenvif/mac.c b/src/xenvif/mac.c index 19666fe..3301ef9 100644 --- a/src/xenvif/mac.c +++ b/src/xenvif/mac.c @@ -357,13 +357,15 @@ MacDumpAddressTable( "mac"); for (Index = 0; Index < Count; Index++) { - CHAR Node[sizeof ("mac/XX")]; + CHAR Node[sizeof ("mac/XXXXXXXXXX")]; status = RtlStringCbPrintfA(Node, sizeof (Node), "mac/%u", Index); ASSERT(NT_SUCCESS(status)); + if (!NT_SUCCESS(status)) + continue; (VOID) XENBUS_STORE(Printf, &Mac->StoreInterface, -- 2.16.2.windows.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |