[Buildroot] [PATCH] ext-toolchain-wrapper.c: Handle an arbitrary amount of arguments

Daniel Nyström daniel.nystrom at timeterminal.se
Tue Jun 21 18:32:29 UTC 2011


2011/6/21 Bjørn Forsman <bjorn.forsman at gmail.com>:
> 2011/6/21 Daniel Nyström <daniel.nystrom at timeterminal.se>:
>> @@ -55,21 +55,27 @@ static const char *get_basename(const char *name)
>>  int main(int argc, char **argv)
>>  {
>>        int i;
>> +       char **args, **cur;
>> +
>> +       cur = args = malloc(sizeof(predef_args) + (sizeof(char *) * argc));
>
> Would you mind checking for args == NULL here, to avoid possible
> segfault on the next line (...and invalid free() later)? Thanks!

Would there be any other case but when running out of memory? Else,
you will have probably have bigger issues. :)

But indeed, handling it is to prefer. I'll fix it PATCHv2 which I will
post when there are no more comments on this one.


More information about the buildroot mailing list