=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/signify/signify.c,v retrieving revision 1.70 retrieving revision 1.71 diff -c -r1.70 -r1.71 *** src/usr.bin/signify/signify.c 2014/04/14 00:35:32 1.70 --- src/usr.bin/signify/signify.c 2014/04/22 05:44:40 1.71 *************** *** 1,4 **** ! /* $OpenBSD: signify.c,v 1.70 2014/04/14 00:35:32 tedu Exp $ */ /* * Copyright (c) 2013 Ted Unangst * --- 1,4 ---- ! /* $OpenBSD: signify.c,v 1.71 2014/04/22 05:44:40 tedu Exp $ */ /* * Copyright (c) 2013 Ted Unangst * *************** *** 137,143 **** if (comment) { if (strlcpy(comment, b64 + COMMENTHDRLEN, COMMENTMAXLEN) >= COMMENTMAXLEN) ! err(1, "comment too long"); } b64end = strchr(commentend + 1, '\n'); if (!b64end) --- 137,143 ---- if (comment) { if (strlcpy(comment, b64 + COMMENTHDRLEN, COMMENTMAXLEN) >= COMMENTMAXLEN) ! errx(1, "comment too long"); } b64end = strchr(commentend + 1, '\n'); if (!b64end) *************** *** 235,241 **** fd = xopen(filename, O_CREAT|oflags|O_NOFOLLOW|O_WRONLY, mode); if (snprintf(header, sizeof(header), "%s%s\n", COMMENTHDR, comment) >= sizeof(header)) ! err(1, "comment too long"); writeall(fd, header, strlen(header), filename); if ((rv = b64_ntop(buf, buflen, b64, sizeof(b64)-1)) == -1) errx(1, "b64 encode failed"); --- 235,241 ---- fd = xopen(filename, O_CREAT|oflags|O_NOFOLLOW|O_WRONLY, mode); if (snprintf(header, sizeof(header), "%s%s\n", COMMENTHDR, comment) >= sizeof(header)) ! errx(1, "comment too long"); writeall(fd, header, strlen(header), filename); if ((rv = b64_ntop(buf, buflen, b64, sizeof(b64)-1)) == -1) errx(1, "b64 encode failed"); *************** *** 327,333 **** if (snprintf(commentbuf, sizeof(commentbuf), "%s secret key", comment) >= sizeof(commentbuf)) ! err(1, "comment too long"); writeb64file(seckeyfile, commentbuf, &enckey, sizeof(enckey), NULL, 0, O_EXCL, 0600); explicit_bzero(&enckey, sizeof(enckey)); --- 327,333 ---- if (snprintf(commentbuf, sizeof(commentbuf), "%s secret key", comment) >= sizeof(commentbuf)) ! errx(1, "comment too long"); writeb64file(seckeyfile, commentbuf, &enckey, sizeof(enckey), NULL, 0, O_EXCL, 0600); explicit_bzero(&enckey, sizeof(enckey)); *************** *** 336,342 **** memcpy(pubkey.fingerprint, fingerprint, FPLEN); if (snprintf(commentbuf, sizeof(commentbuf), "%s public key", comment) >= sizeof(commentbuf)) ! err(1, "comment too long"); writeb64file(pubkeyfile, commentbuf, &pubkey, sizeof(pubkey), NULL, 0, O_EXCL, 0666); } --- 336,342 ---- memcpy(pubkey.fingerprint, fingerprint, FPLEN); if (snprintf(commentbuf, sizeof(commentbuf), "%s public key", comment) >= sizeof(commentbuf)) ! errx(1, "comment too long"); writeb64file(pubkeyfile, commentbuf, &pubkey, sizeof(pubkey), NULL, 0, O_EXCL, 0666); } *************** *** 383,393 **** if ((secname = strstr(seckeyfile, ".sec")) && strlen(secname) == 4) { if (snprintf(sigcomment, sizeof(sigcomment), VERIFYWITH "%.*s.pub", (int)strlen(seckeyfile) - 4, seckeyfile) >= sizeof(sigcomment)) ! err(1, "comment too long"); } else { if (snprintf(sigcomment, sizeof(sigcomment), "signature from %s", comment) >= sizeof(sigcomment)) ! err(1, "comment too long"); } if (embedded) writeb64file(sigfile, sigcomment, &sig, sizeof(sig), msg, --- 383,393 ---- if ((secname = strstr(seckeyfile, ".sec")) && strlen(secname) == 4) { if (snprintf(sigcomment, sizeof(sigcomment), VERIFYWITH "%.*s.pub", (int)strlen(seckeyfile) - 4, seckeyfile) >= sizeof(sigcomment)) ! errx(1, "comment too long"); } else { if (snprintf(sigcomment, sizeof(sigcomment), "signature from %s", comment) >= sizeof(sigcomment)) ! errx(1, "comment too long"); } if (embedded) writeb64file(sigfile, sigcomment, &sig, sizeof(sig), msg,