Cole Robinson
Mon, 08 Feb 2010 06:35:36 -0800
On 02/04/2010 02:44 PM, David Lutterkort wrote:
> On Sat, 2010-01-30 at 19:59 -0500, Cole Robinson wrote:
>> Similar to how virsh works, one shot commands can be invoked as:
>>
>> ncftool <cmd> <options>
>
> ACK. The use of malloc wasn't right, since you did strncat into a
> malloc'd area that was never zeroed. I changed that with this
> incremental patch:
>
> diff --git a/src/ncftool.c b/src/ncftool.c
> index 96276e9..35e9252 100644
> --- a/src/ncftool.c
> +++ b/src/ncftool.c
> @@ -803,8 +803,8 @@ int main(int argc, char **argv) {
> cmdsize += strlen(argv[i]) + 1;
> }
>
> - cmd = malloc(cmdsize + 1);
> - if (!cmd) {
> + r = ALLOC_N(cmd, cmdsize + 1);
> + if (r < 0) {
> fprintf(stderr, "Out of memory\n");
> exit(EXIT_FAILURE);
> }
Whoops, thanks for the fix. - Cole _______________________________________________ netcf-devel mailing list netcf-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/netcf-devel