=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/signify/signify.c,v retrieving revision 1.131 retrieving revision 1.132 diff -c -r1.131 -r1.132 *** src/usr.bin/signify/signify.c 2019/03/23 07:10:06 1.131 --- src/usr.bin/signify/signify.c 2019/07/03 03:24:02 1.132 *************** *** 1,4 **** ! /* $OpenBSD: signify.c,v 1.131 2019/03/23 07:10:06 tedu Exp $ */ /* * Copyright (c) 2013 Ted Unangst * --- 1,4 ---- ! /* $OpenBSD: signify.c,v 1.132 2019/07/03 03:24:02 deraadt Exp $ */ /* * Copyright (c) 2013 Ted Unangst * *************** *** 330,336 **** explicit_bzero(xorkey, sizeof(xorkey)); nr = snprintf(commentbuf, sizeof(commentbuf), "%s secret key", comment); ! if (nr == -1 || nr >= sizeof(commentbuf)) errx(1, "comment too long"); writekeyfile(seckeyfile, commentbuf, &enckey, sizeof(enckey), O_EXCL, 0600); --- 330,336 ---- explicit_bzero(xorkey, sizeof(xorkey)); nr = snprintf(commentbuf, sizeof(commentbuf), "%s secret key", comment); ! if (nr < 0 || nr >= sizeof(commentbuf)) errx(1, "comment too long"); writekeyfile(seckeyfile, commentbuf, &enckey, sizeof(enckey), O_EXCL, 0600); *************** *** 339,345 **** memcpy(pubkey.pkalg, PKALG, 2); memcpy(pubkey.keynum, keynum, KEYNUMLEN); nr = snprintf(commentbuf, sizeof(commentbuf), "%s public key", comment); ! if (nr == -1 || nr >= sizeof(commentbuf)) errx(1, "comment too long"); writekeyfile(pubkeyfile, commentbuf, &pubkey, sizeof(pubkey), O_EXCL, 0666); --- 339,345 ---- memcpy(pubkey.pkalg, PKALG, 2); memcpy(pubkey.keynum, keynum, KEYNUMLEN); nr = snprintf(commentbuf, sizeof(commentbuf), "%s public key", comment); ! if (nr < 0 || nr >= sizeof(commentbuf)) errx(1, "comment too long"); writekeyfile(pubkeyfile, commentbuf, &pubkey, sizeof(pubkey), O_EXCL, 0666); *************** *** 403,409 **** nr = snprintf(sigcomment, sizeof(sigcomment), VERIFYWITH "%.*s.pub", (int)strlen(keyname) - 4, keyname); } ! if (nr == -1 || nr >= sizeof(sigcomment)) errx(1, "comment too long"); if (memcmp(enckey.kdfalg, KDFALG, 2) != 0) --- 403,409 ---- nr = snprintf(sigcomment, sizeof(sigcomment), VERIFYWITH "%.*s.pub", (int)strlen(keyname) - 4, keyname); } ! if (nr < 0 || nr >= sizeof(sigcomment)) errx(1, "comment too long"); if (memcmp(enckey.kdfalg, KDFALG, 2) != 0) *************** *** 858,864 **** usage("must specify sigfile with - message"); nr = snprintf(sigfilebuf, sizeof(sigfilebuf), "%s.sig", msgfile); ! if (nr == -1 || nr >= sizeof(sigfilebuf)) errx(1, "path too long"); sigfile = sigfilebuf; } --- 858,864 ---- usage("must specify sigfile with - message"); nr = snprintf(sigfilebuf, sizeof(sigfilebuf), "%s.sig", msgfile); ! if (nr < 0 || nr >= sizeof(sigfilebuf)) errx(1, "path too long"); sigfile = sigfilebuf; }