]> git.dujemihanovic.xyz Git - u-boot.git/commit
cmd: gpt: fix calc_parts_list_len()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 2 Sep 2023 07:35:23 +0000 (09:35 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 11 Sep 2023 20:31:25 +0000 (16:31 -0400)
commit69f4d37302583c3a2c8445ff69826c52c6fce7e3
treea76787982bb806876a37d156dc6f0d784628185c
parent396f315520bcbcc2b710ab696326b239577c1ad2
cmd: gpt: fix calc_parts_list_len()

* Avoid incrementing by moving comma into strlen("uuid_disk=,") and
  considering NUL byte.
* Appending a UUID only adds UUID_STR_LEN bytes.
  Don't count the terminating NUL.
* The length of the hexadecimal representation of lba_int is
  2 * sizeof(lba_int).
* We don't use a 'MiB' postfix but a '0x' prefix.
* The uuid field is only needed if configured.

Fixes: 2fcaa413b3f6 ("gpt: harden set_gpt_info() against non NULL-terminated strings")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
cmd/gpt.c