diff options
author | 2009-11-26 22:32:00 +0000 | |
---|---|---|
committer | 2009-11-26 22:32:00 +0000 | |
commit | 7c368b34e1bfba42ab32cc370f15f4455199422b (patch) | |
tree | 2daae882add60246ba4f54e7ac24511b58aefcfb /usr.bin/tmux/cmd-load-buffer.c | |
parent | Tidy up various bits of the paste code, make the data buffer char * and add (diff) | |
download | wireguard-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.c | 6 |
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; |