summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-load-buffer.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-11-26 22:32:00 +0000
committernicm <nicm@openbsd.org>2009-11-26 22:32:00 +0000
commit7c368b34e1bfba42ab32cc370f15f4455199422b (patch)
tree2daae882add60246ba4f54e7ac24511b58aefcfb /usr.bin/tmux/cmd-load-buffer.c
parentTidy up various bits of the paste code, make the data buffer char * and add (diff)
downloadwireguard-openbsd-7c368b34e1bfba42ab32cc370f15f4455199422b.tar.xz
wireguard-openbsd-7c368b34e1bfba42ab32cc370f15f4455199422b.zip
Change paranoia check to check for <= 0 and to avoid warning.
Diffstat (limited to 'usr.bin/tmux/cmd-load-buffer.c')
-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;