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>
1 file changed