-/* $OpenBSD: signify.c,v 1.72 2014/04/22 21:24:20 tedu Exp $ */
+/* $OpenBSD: signify.c,v 1.73 2014/05/06 23:17:13 tedu Exp $ */
/*
* Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
*
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 > (1UL << 30))
+ if (sb.st_size > maxmsgsize)
errx(1, "msg too large in %s", filename);
space = sb.st_size + 1;
} else {
msg = xmalloc(space + 1);
while (1) {
if (space == 0) {
- if (msglen * 2 > (1UL << 30))
+ if (msglen * 2 > maxmsgsize)
errx(1, "msg too large in %s", filename);
space = msglen;
if (!(msg = realloc(msg, msglen + space + 1)))