summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2021-10-23 08:13:48 +0000
committertb <>2021-10-23 08:13:48 +0000
commitab9714f1896eae0c6911ffa8284e65990a73583c (patch)
tree2e05190b142dd7ecd1e3993f44c270c959e23cfa /src
parent0b36022618e1b10350432bff13aba6c2b4eaef60 (diff)
downloadopenbsd-ab9714f1896eae0c6911ffa8284e65990a73583c.tar.gz
openbsd-ab9714f1896eae0c6911ffa8284e65990a73583c.tar.bz2
openbsd-ab9714f1896eae0c6911ffa8284e65990a73583c.zip
Add a length check before NUL-terminating target. From Jonas Termansen.
ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/openssl/certhash.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/usr.bin/openssl/certhash.c b/src/usr.bin/openssl/certhash.c
index 31c4899fae..a4417a2b26 100644
--- a/src/usr.bin/openssl/certhash.c
+++ b/src/usr.bin/openssl/certhash.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: certhash.c,v 1.18 2021/08/28 08:16:39 tb Exp $ */ 1/* $OpenBSD: certhash.c,v 1.19 2021/10/23 08:13:48 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -490,6 +490,10 @@ certhash_link(struct dirent *dep, struct hashinfo **links)
490 fprintf(stderr, "failed to readlink %s\n", dep->d_name); 490 fprintf(stderr, "failed to readlink %s\n", dep->d_name);
491 return (-1); 491 return (-1);
492 } 492 }
493 if (n >= sizeof(target) - 1) {
494 fprintf(stderr, "symbolic link is too long %s\n", dep->d_name);
495 return (-1);
496 }
493 target[n] = '\0'; 497 target[n] = '\0';
494 498
495 hi = hashinfo_from_linkname(dep->d_name, target); 499 hi = hashinfo_from_linkname(dep->d_name, target);