Skip to content

Commit

Permalink
ASN.1: Fix check for strdup() success
Browse files Browse the repository at this point in the history
It seems there is a misprint in the check of strdup() return code that
can lead to NULL pointer dereference.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 4520c6a ("X.509: Add simple ASN.1 grammar compiler")
Signed-off-by: Ekaterina Orlova <[email protected]>
Cc: David Woodhouse <[email protected]>
Cc: James Bottomley <[email protected]>
Cc: Jarkko Sakkinen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]/
Signed-off-by: David Howells <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Ekaterina Orlova authored and torvalds committed Apr 21, 2023
1 parent 2af3e53 commit 5a43001
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/asn1_compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ int main(int argc, char **argv)
p = strrchr(argv[1], '/');
p = p ? p + 1 : argv[1];
grammar_name = strdup(p);
if (!p) {
if (!grammar_name) {
perror(NULL);
exit(1);
}
Expand Down

0 comments on commit 5a43001

Please sign in to comment.