mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Functions kmip_node_get_structure_element_count() and kmip_node_get_structure_element_by_tag_count() return an unsigned int, but the error case returns -1. This leads to a wrap around actually returning 0xffffffff which the caller might interpret as a very large number of elements. Return 0 in case of an error instead. Also fix some callers to not unconditionally subtract -1 from the returned value, but return an error if the returned value is zero. These callers check the preconditions upfront, so the error case won't be hit anyway. Assisted-by: IBM Bob:2.0.0 Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> Reviewed-by: Finn Callies <fcallies@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
45 KiB
45 KiB