barebox crashes with CONFIG_CMD_MAGICVAR=y and CONFIG_CMD_MAGICVAR_HELP unset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

with

	CONFIG_CMD_MAGICVAR=y
	# CONFIG_CMD_MAGICVAR_HELP is not set

calling magicvar results in

	md->description = xstrdup(description)

in line 64 of commands/magicvar.c. As CONFIG_CMD_MAGICVAR_HELP is not
set, description is NULL which makes xstrdup fail.

I fixed it here doing

-       md->description = xstrdup(description);
+       md->description = description ? xstrdup(description) : NULL;

but I can imagine other variants:

	if (IS_ENABLED(CONFIG_CMD_MAGICVAR_HELP))
		md->description = xstrdup(description);

or fixing xstrdup to not choke on NULL.

What do you prefer?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux