aboutsummaryrefslogtreecommitdiffstats
path: root/capture_wpcap_packet.c
diff options
context:
space:
mode:
authorulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>2007-02-25 12:50:21 +0000
committerulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>2007-02-25 12:50:21 +0000
commit54e4defcc0b9bf410b262de53cd7f90f3dc9565d (patch)
tree41a281db71d668e5c991abe8943f19459f9993f5 /capture_wpcap_packet.c
parent2ac7449d3ccc39743f8c67bffc0ca85f7529a9be (diff)
fix #1399: don't assert the oidlength returned from the network card driver, but simply return that the PacketRequest call failed in that case.
BTW: this is a serious bug in the specific network card driver of this report, it returned a buffer length LONGER than the provided buffer length one! git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20923 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'capture_wpcap_packet.c')
-rw-r--r--capture_wpcap_packet.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/capture_wpcap_packet.c b/capture_wpcap_packet.c
index fe9438fbc4..4b58cd37c4 100644
--- a/capture_wpcap_packet.c
+++ b/capture_wpcap_packet.c
@@ -242,9 +242,10 @@ wpcap_packet_request(void *adapter, ULONG Oid, int set, char *value, unsigned in
return 0;
}
+ /* get a buffer suitable for PacketRequest() */
OidData=GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT,IoCtlBufferLength);
if (OidData == NULL) {
- g_warning("packet_link_status failed\n");
+ g_warning("GlobalAllocPtr failed for %u\n", IoCtlBufferLength);
return 0;
}
@@ -255,9 +256,15 @@ wpcap_packet_request(void *adapter, ULONG Oid, int set, char *value, unsigned in
Status = p_PacketRequest(adapter, set, OidData);
if(Status) {
- g_assert(OidData->Length <= *length);
- memcpy(value, OidData->Data, OidData->Length);
- *length = OidData->Length;
+ if(OidData->Length <= *length) {
+ /* copy value from driver */
+ memcpy(value, OidData->Data, OidData->Length);
+ *length = OidData->Length;
+ } else {
+ /* the driver returned a value that is longer than expected (and longer than the given buffer) */
+ g_warning("returned oid too long, Oid: 0x%x OidLen:%u MaxLen:%u", Oid, OidData->Length, *length);
+ Status = FALSE;
+ }
}
GlobalFreePtr (OidData);