common: Add NULL checks for xrealloc in make_string cli_hush.c
authorAnton Moryakov <ant.v.moryakov@gmail.com>
Thu, 6 Feb 2025 22:01:23 +0000 (01:01 +0300)
committerTom Rini <trini@konsulko.com>
Tue, 11 Feb 2025 14:17:23 +0000 (08:17 -0600)
commitb4df7003dfd06da630c248c958993a686fb1619b
treee138100fc9bd9b63bcaae69140443d2d8b0e84c2
parentbdf056441de30e639d2bc80c32027de3bf28ac4a
common: Add NULL checks for xrealloc in make_string cli_hush.c

- Check return value of xrealloc for NULL.
- Free allocated memory and return NULL if xrealloc fails.
- Prevent NULL pointer dereference in strlen and strcat.

Triggers found by static analyzer Svace.

Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
common/cli_hush.c