aboutsummaryrefslogtreecommitdiff
path: root/lib/libsecureboot/veopen.c
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2020-03-25 19:12:19 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2020-03-25 19:12:19 +0000
commit53f151f90603580d0c0a8fa1840ba1262958a7c1 (patch)
tree78969ebac620eb68b5a22beb561b91e35c99db70 /lib/libsecureboot/veopen.c
parent7c63520c42754642acce60c7be5fc9676e3e3266 (diff)
downloadsrc-53f151f90603580d0c0a8fa1840ba1262958a7c1.tar.gz
src-53f151f90603580d0c0a8fa1840ba1262958a7c1.zip
Notes
Diffstat (limited to 'lib/libsecureboot/veopen.c')
-rw-r--r--lib/libsecureboot/veopen.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libsecureboot/veopen.c b/lib/libsecureboot/veopen.c
index 6ecf85c44af1..da6291504c4c 100644
--- a/lib/libsecureboot/veopen.c
+++ b/lib/libsecureboot/veopen.c
@@ -86,9 +86,11 @@ fingerprint_info_add(const char *filename, const char *prefix,
}
nfip->fi_prefix = strdup(filename);
cp = strrchr(nfip->fi_prefix, '/');
- if (cp)
+ if (cp == nfip->fi_prefix) {
+ cp[1] = '\0';
+ } else if (cp) {
*cp = '\0';
- else {
+ } else {
free(nfip->fi_prefix);
free(nfip);
return;
@@ -96,7 +98,7 @@ fingerprint_info_add(const char *filename, const char *prefix,
}
/* collapse any trailing ..[/] */
n = 0;
- while ((cp = strrchr(nfip->fi_prefix, '/')) != NULL) {
+ while ((cp = strrchr(nfip->fi_prefix, '/')) > nfip->fi_prefix) {
if (cp[1] == '\0') { /* trailing "/" */
*cp = '\0';
continue;