summaryrefslogtreecommitdiffstats
path: root/cmd-load-buffer.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-11-26 22:32:00 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-11-26 22:32:00 +0000
commitc2eb869f7276ad3832d3111542a859f3e96772b2 (patch)
tree419e1edbf654735fce282709f0ef9bb57aa2cf8a /cmd-load-buffer.c
parent8cb410c63cbec58dc736e160ffe88a67af46e4c9 (diff)
Change paranoia check to check for <= 0 and to avoid warning.
Diffstat (limited to 'cmd-load-buffer.c')
-rw-r--r--cmd-load-buffer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c
index 944c1237..b6386b83 100644
--- a/cmd-load-buffer.c
+++ b/cmd-load-buffer.c
@@ -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;