diff options
| author | Hauke Mehrtens | 2026-04-23 22:13:08 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2026-06-07 11:23:25 +0000 |
| commit | 0ba1b8718be5a2c7e0049a5ed5486f0ffe81fc21 (patch) | |
| tree | 07e6bcc3c6d50bd6d56d20d23250751503315301 | |
| parent | 53d2d11fb00d5cf19c1b30ab20b158ff664bd89e (diff) | |
| download | uclient-0ba1b8718be5a2c7e0049a5ed5486f0ffe81fc21.tar.gz | |
ucode: check calloc return in uc_uclient_new
If calloc failed, the following ucl->cb.* assignments dereferenced a
NULL pointer. Return NULL on allocation failure.
Assisted-by: Claude:claude-opus-4-7
Link: https://github.com/openwrt/uclient/pull/16
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
| -rw-r--r-- | ucode.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -508,6 +508,9 @@ uc_uclient_new(uc_vm_t *vm, size_t nargs) return NULL; ucl = calloc(1, sizeof(*ucl)); + if (!ucl) + return NULL; + if (ucv_property_get(cb, "data_read")) ucl->cb.data_read = uc_cb_data_read; if (ucv_property_get(cb, "get_post_data")) |