Skip to content

Commit 24869e7

Browse files
Jakujefrankmorgner
authored andcommitted
pkcs15init: Avoid buffer overrun
The maximum path length is 16 bytes and if we want to extend the path, we need to make sure its not too long. Thanks oss-fuzz. https://issues.oss-fuzz.com/issues/467161860 Signed-off-by: Jakub Jelen <jjelen@redhat.com>
1 parent 35b2f54 commit 24869e7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/pkcs15init/pkcs15-cflex.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,9 @@ cflex_create_pin_file(sc_profile_t *profile, sc_pkcs15_card_t *p15card,
539539

540540
/* Build the CHV path */
541541
path = *df_path;
542+
if (path.len > SC_MAX_PATH_SIZE - 2) {
543+
return SC_ERROR_INVALID_ARGUMENTS;
544+
}
542545
path.value[path.len++] = ref - 1;
543546
path.value[path.len++] = 0;
544547

0 commit comments

Comments
 (0)