Skip to content

Conversation

fmasar
Copy link

@fmasar fmasar commented Aug 27, 2025

There is string and int concatenation in handling unsupported key types which is leading to incorrect application crash.

@fmasar fmasar requested a review from d3zd3z as a code owner August 27, 2025 19:37
@fmasar fmasar changed the title Fixed str and int concat in key loading exceptions imgtool: Fixed str and int concat in key loading exceptions Aug 27, 2025
if isinstance(pk, RSAPrivateKey):
if pk.key_size not in RSA_KEY_SIZES:
raise Exception("Unsupported RSA key size: " + pk.key_size)
raise Exception("Unsupported RSA key size: " + str(pk.key_size))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be done in more pythoning way with fstring formatting like:

raise Exception(f"Unsupported RSA key size: {pk.key_size}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants