From: tedu Date: Fri, 16 Jan 2015 06:16:12 +0000 (+0000) Subject: improve checksum parsing slightly. now handles filenames with spaces. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3111eefda9c172ddb902efb107fd6a2098670dc5;p=openbsd improve checksum parsing slightly. now handles filenames with spaces. (though not names with ')'; sorry.) --- 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 * @@ -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);