summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2026-10-22 12:41:45 +0800
committersakumisu <[email protected]>2026-10-22 17:14:30 +0800
commitd002406b9359af01fcfb601d88a2818b71856222 (patch)
tree124b163bb743045ce7d16fc11500c39fb8c9f443 /common
parent26b0feb09bb58ebb7a3161b5605f8e186b96db1f (diff)
fix(security): check array overflowdev
Signed-off-by: sakumisu <[email protected]>
Diffstat (limited to 'common')
-rw-r--r--common/usb_def.h1
-rw-r--r--common/usb_log.h17
2 files changed, 16 insertions, 2 deletions
diff --git a/common/usb_def.h b/common/usb_def.h
index 73d2b800..cf0cb089 100644
--- a/common/usb_def.h
+++ b/common/usb_def.h
@@ -513,6 +513,7 @@ struct usb_msosv1_descriptor {
uint8_t vendor_code;
const uint8_t *compat_id;
const uint8_t **comp_id_property;
+ uint16_t comp_id_property_count; /* Number of entries; zero disables property requests. */
};
/* MS OS 2.0 Header descriptor */
diff --git a/common/usb_log.h b/common/usb_log.h
index ca03af5b..a1bc501c 100644
--- a/common/usb_log.h
+++ b/common/usb_log.h
@@ -95,8 +95,21 @@
} \
} while (false)
#else
-#define USB_ASSERT(f) {}
-#define USB_ASSERT_MSG(f, fmt, ...) {}
+#define USB_ASSERT(f) \
+ do { \
+ if (!(f)) { \
+ while (1) { \
+ } \
+ } \
+ } while (false)
+
+#define USB_ASSERT_MSG(f, fmt, ...) \
+ do { \
+ if (!(f)) { \
+ while (1) { \
+ } \
+ } \
+ } while (false)
#endif
#define ___is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ')