=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/signify/signify.c,v retrieving revision 1.72 retrieving revision 1.73 diff -c -r1.72 -r1.73 *** src/usr.bin/signify/signify.c 2014/04/22 21:24:20 1.72 --- src/usr.bin/signify/signify.c 2014/05/06 23:17:13 1.73 *************** *** 1,4 **** ! /* $OpenBSD: signify.c,v 1.72 2014/04/22 21:24:20 tedu Exp $ */ /* * Copyright (c) 2013 Ted Unangst * --- 1,4 ---- ! /* $OpenBSD: signify.c,v 1.73 2014/05/06 23:17:13 tedu Exp $ */ /* * Copyright (c) 2013 Ted Unangst * *************** *** 175,184 **** struct stat sb; ssize_t x, space; int fd; fd = xopen(filename, O_RDONLY | O_NOFOLLOW, 0); if (fstat(fd, &sb) == 0 && S_ISREG(sb.st_mode)) { ! if (sb.st_size > (1UL << 30)) errx(1, "msg too large in %s", filename); space = sb.st_size + 1; } else { --- 175,185 ---- struct stat sb; ssize_t x, space; int fd; + const unsigned long long maxmsgsize = 1UL << 30; fd = xopen(filename, O_RDONLY | O_NOFOLLOW, 0); if (fstat(fd, &sb) == 0 && S_ISREG(sb.st_mode)) { ! if (sb.st_size > maxmsgsize) errx(1, "msg too large in %s", filename); space = sb.st_size + 1; } else { *************** *** 188,194 **** msg = xmalloc(space + 1); while (1) { if (space == 0) { ! if (msglen * 2 > (1UL << 30)) errx(1, "msg too large in %s", filename); space = msglen; if (!(msg = realloc(msg, msglen + space + 1))) --- 189,195 ---- msg = xmalloc(space + 1); while (1) { if (space == 0) { ! if (msglen * 2 > maxmsgsize) errx(1, "msg too large in %s", filename); space = msglen; if (!(msg = realloc(msg, msglen + space + 1)))