summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEkaterina Orlova <vorobushek.ok@gmail.com>2023-04-21 15:35:39 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-26 11:18:58 +0200
commit082b2dd841c76577f69af971c766676524c99f0e (patch)
tree6de90ec8b35c161eff60022b598c5d7cc83de22b /scripts
parentdeb7a188507d5dc0979d7988a840de0f57ded557 (diff)
downloadlinux-stable-082b2dd841c76577f69af971c766676524c99f0e.tar.gz
linux-stable-082b2dd841c76577f69af971c766676524c99f0e.tar.bz2
linux-stable-082b2dd841c76577f69af971c766676524c99f0e.zip
ASN.1: Fix check for strdup() success
commit 5a43001c01691dcbd396541e6faa2c0077378f48 upstream. 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: 4520c6a49af8 ("X.509: Add simple ASN.1 grammar compiler") Signed-off-by: Ekaterina Orlova <vorobushek.ok@gmail.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jarkko Sakkinen <jarkko@kernel.org> Cc: keyrings@vger.kernel.org Cc: linux-kbuild@vger.kernel.org Link: https://lore.kernel.org/r/20230315172130.140-1-vorobushek.ok@gmail.com/ Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/asn1_compiler.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
index c1b7ef3e24c1..15d829dd961a 100644
--- a/scripts/asn1_compiler.c
+++ b/scripts/asn1_compiler.c
@@ -629,7 +629,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);
}