diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-11-26 22:32:01 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-11-26 22:32:01 +0000 |
commit | 3598e5e70602802384b1986b36590ddd7779a248 (patch) | |
tree | 077a88f89ff9a66c7794be6106b66cd252e72ebc /usr.bin/tmux | |
parent | d5a8d58642d15648eee6ce4426aca635f5bf272e (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.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; |