diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2015-01-16 06:16:13 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2015-01-16 06:16:13 +0000 |
commit | 79e3d817585ca08a91e30ad14abe43e2ab70295f (patch) | |
tree | 206807ff742c7a699c632181828b320afc6acf95 /usr.bin/signify | |
parent | 3607a7c7825409a7effc8e6d160381f02afdd49a (diff) |
improve checksum parsing slightly. now handles filenames with spaces.
(though not names with ')'; sorry.)
Diffstat (limited to 'usr.bin/signify')
-rw-r--r-- | usr.bin/signify/signify.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/signify/signify.c b/usr.bin/signify/signify.c index ec7a791cd32..06d28dae022 100644 --- a/usr.bin/signify/signify.c +++ b/usr.bin/signify/signify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signify.c,v 1.99 2015/01/16 06:00:39 tedu Exp $ */ +/* $OpenBSD: signify.c,v 1.100 2015/01/16 06:16:12 tedu Exp $ */ /* * Copyright (c) 2013 Ted Unangst <tedu@openbsd.org> * @@ -595,11 +595,10 @@ verifychecksums(char *msg, int argc, char **argv, int quiet) #if PATH_MAX < 1024 || HASHBUFSIZE < 224 #error sizes are wrong #endif - rv = sscanf(line, "%31s (%1023s = %223s", + rv = sscanf(line, "%31s (%1023[^)]) = %223s", c.algo, c.file, c.hash); - if (rv != 3 || c.file[0] == 0 || c.file[strlen(c.file)-1] != ')') + if (rv != 3) errx(1, "unable to parse checksum line %s", line); - c.file[strlen(c.file) - 1] = '\0'; line = endline; if (argc) { slot = ohash_qlookup(&myh, c.file); |