Re: [PATCH] Prevent a short allocation by checking upper_length
Colin Wee <[email protected]>
| Newsgroups | dev.linux.lists.connman |
|---|---|
| Message-ID | <afzxdg6r2xolx6t3juav7vy6jz6jp3ui4nx266ucnxi6ep5xuq@zjca3q44s5jy> |
Hey Marcel / Connman team, Just wanted to check in here. Have you had a chance to review this patch? -Colin On Fri, May 10, 2024 at 04:53:16PM GMT, Colin Wee wrote: > From: Craig Young <[email protected]> > > --- > gdhcp/client.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/gdhcp/client.c b/gdhcp/client.c > index 2afa19e6..c9234a18 100644 > --- a/gdhcp/client.c > +++ b/gdhcp/client.c > @@ -1863,6 +1863,8 @@ static char *malloc_option_value_string(uint8_t *option, GDHCPOptionType type) > return NULL; > upper_length = len_of_option_as_string[type] * > ((unsigned)len / (unsigned)optlen); > + if (upper_length == 0) > + return NULL; > dest = ret = g_malloc(upper_length + 1); > if (!ret) > return NULL; > -- > 2.45.0