
26 May
2017
26 May
'17
2:39 p.m.
On Sat, May 20, 2017 at 07:27:54PM -0700, alison@peloton-tech.com wrote:
From: Alison Chaiken alison@she-devel.com
Make the partition table available for modification by reading it from the user-specified device into a linked list. Provide an accessor function for command-line testing.
Signed-off-by: Alison Chaiken alison@peloton-tech.com
[snip]
- /*
* 33 rather than 32, as each string must be null-terminated;
* other extract_val() above will fail.
*/
- strncpy((char *)newpart->gpt_part_info.name, (const char *)info->name, 33);
- strncpy((char *)newpart->gpt_part_info.type, (const char *)info->type, 33);
This isn't right. We have name[32]/type[32] so we're overflowing. I'm not quite sure where 32 came from and if we should be defining a name for it as well. But to make sure it is null-terminated we should be here memset'ing after malloc.
- newpart->gpt_part_info.bootable = info->bootable;
+#ifdef CONFIG_PARTITION_UUIDS
- strncpy(newpart->gpt_part_info.uuid, (const char *)info->uuid,
UUID_STR_LEN + 1);
+#endif
Then this should just be copying UUID_STR_LEN over.
- if (!valid_parts) {
printf("** No valid partitions found **\n");
del_gpt_info();
return -1;
We should return something from errno here rather than -1. Thanks!
--
Tom