summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-11-26 22:32:01 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-11-26 22:32:01 +0000
commit3598e5e70602802384b1986b36590ddd7779a248 (patch)
tree077a88f89ff9a66c7794be6106b66cd252e72ebc /usr.bin/tmux
parentd5a8d58642d15648eee6ce4426aca635f5bf272e (diff)
Change paranoia check to check for <= 0 and to avoid warning.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/cmd-load-buffer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-load-buffer.c b/usr.bin/tmux/cmd-load-buffer.c
index 9ad8d7bc73e..e42d5678402 100644
--- a/usr.bin/tmux/cmd-load-buffer.c
+++ b/usr.bin/tmux/cmd-load-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-load-buffer.c,v 1.9 2009/11/26 22:28:24 nicm Exp $ */
+/* $OpenBSD: cmd-load-buffer.c,v 1.10 2009/11/26 22:32:00 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -66,8 +66,8 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
ctx->error(ctx, "%s: %s", data->arg, strerror(errno));
goto error;
}
- if (sb.st_size > SIZE_MAX) {
- ctx->error(ctx, "%s: file too large", data->arg);
+ if (sb.st_size <= 0 || (uintmax_t) sb.st_size > SIZE_MAX) {
+ ctx->error(ctx, "%s: file empty or too large", data->arg);
goto error;
}
psize = (size_t) sb.st_size;