diff options
author | Simon J. Gerraty <sjg@FreeBSD.org> | 2020-03-25 19:12:19 +0000 |
---|---|---|
committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2020-03-25 19:12:19 +0000 |
commit | 53f151f90603580d0c0a8fa1840ba1262958a7c1 (patch) | |
tree | 78969ebac620eb68b5a22beb561b91e35c99db70 /lib/libsecureboot/veopen.c | |
parent | 7c63520c42754642acce60c7be5fc9676e3e3266 (diff) | |
download | src-53f151f90603580d0c0a8fa1840ba1262958a7c1.tar.gz src-53f151f90603580d0c0a8fa1840ba1262958a7c1.zip |
Notes
Diffstat (limited to 'lib/libsecureboot/veopen.c')
-rw-r--r-- | lib/libsecureboot/veopen.c | 8 |
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; |