#define NDIS_STATUS_NOT_SUPPORTED 0xc00000bb /* STATUS_NOT_SUPPORTED */
#define NDIS_STATUS_NOT_RECOGNIZED 0x00010001
+#ifndef PACKET_OID_DATA_LENGTH
+#define PACKET_OID_DATA_LENGTH(_DataLength) \
+ (offsetof(PACKET_OID_DATA, Data) + _DataLength)
+#endif
static int
oid_get_request(ADAPTER *adapter, bpf_u_int32 oid, void *data, size_t *lenp,
char *errbuf)
/*
* Allocate a PACKET_OID_DATA structure to hand to PacketRequest().
- * It should be big enough to hold "*lenp" bytes of data; it
- * will actually be slightly larger, as PACKET_OID_DATA has a
- * 1-byte data array at the end, standing in for the variable-length
- * data that's actually there.
+ * It should be big enough to hold "*lenp" bytes of data;
*/
- oid_data_arg = malloc(sizeof (PACKET_OID_DATA) + *lenp);
+ oid_data_arg = malloc(PACKET_OID_DATA_LENGTH(*lenp));
if (oid_data_arg == NULL) {
snprintf(errbuf, PCAP_ERRBUF_SIZE,
"Couldn't allocate argument buffer for PacketRequest");
/*
* Allocate a PACKET_OID_DATA structure to hand to PacketRequest().
- * It should be big enough to hold "*lenp" bytes of data; it
- * will actually be slightly larger, as PACKET_OID_DATA has a
- * 1-byte data array at the end, standing in for the variable-length
- * data that's actually there.
+ * It should be big enough to hold "*lenp" bytes of data;
*/
- oid_data_arg = malloc(sizeof (PACKET_OID_DATA) + *lenp);
+ oid_data_arg = malloc(PACKET_OID_DATA_LENGTH(*lenp));
if (oid_data_arg == NULL) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"Couldn't allocate argument buffer for PacketRequest");