Change paranoia check to check for <= 0 and to avoid warning.

pull/1/head
Nicholas Marriott 2009-11-26 22:32:00 +00:00
parent 8cb410c63c
commit c2eb869f72
1 changed files with 2 additions and 2 deletions

View File

@ -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;