diff options
| author | Hauke Mehrtens | 2026-04-23 21:37:22 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2026-06-18 22:07:45 +0000 |
| commit | 315e0af12629c1aa77ab9150f19cd4b413a3b1f7 (patch) | |
| tree | 060a4a2ffd47a867188f2793536a9a3a44a4c2d6 | |
| parent | b4a718b6d374f1ac4d8cc7045cf0cca7e5a20dde (diff) | |
| download | libubox-315e0af12629c1aa77ab9150f19cd4b413a3b1f7.tar.gz | |
blob: use size_t for blob_memdup() length
blob_pad_len() returns size_t and the value is used as a memory
allocation/copy size. Storing it in a signed int could truncate or
turn the value negative on platforms or inputs where the padded
length exceeds INT_MAX, leading to a too-small malloc() and an
out-of-bounds memcpy().
Link: https://github.com/openwrt/libubox/pull/42
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 02fccb465651f470ddd988f60036f22e485b5ac8)
| -rw-r--r-- | blob.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -338,7 +338,7 @@ struct blob_attr * blob_memdup(const struct blob_attr *attr) { struct blob_attr *ret; - int size = blob_pad_len(attr); + size_t size = blob_pad_len(attr); ret = malloc(size); if (!ret) |