mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-08 08:07:10 +02:00
BUG/MINOR: ssl/cli: check trash allocation in cli_io_handler_commit_cert()
Possible NULL pointer dereference found by coverity. Fix #350 #340.
This commit is contained in:
parent
ae6f125c7b
commit
33cc76f918
@ -10016,6 +10016,9 @@ static int cli_io_handler_commit_cert(struct appctx *appctx)
|
|||||||
struct ckch_inst *ckchi, *ckchis;
|
struct ckch_inst *ckchi, *ckchis;
|
||||||
struct buffer *trash = alloc_trash_chunk();
|
struct buffer *trash = alloc_trash_chunk();
|
||||||
|
|
||||||
|
if (trash == NULL)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
|
if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -10142,10 +10145,12 @@ static int cli_io_handler_commit_cert(struct appctx *appctx)
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
/* spin unlock and free are done in the release function */
|
/* spin unlock and free are done in the release function */
|
||||||
chunk_appendf(trash, "\n%sFailed!\n", err);
|
if (trash) {
|
||||||
if (ci_putchk(si_ic(si), trash) == -1)
|
chunk_appendf(trash, "\n%sFailed!\n", err);
|
||||||
si_rx_room_blk(si);
|
if (ci_putchk(si_ic(si), trash) == -1)
|
||||||
free_trash_chunk(trash);
|
si_rx_room_blk(si);
|
||||||
|
free_trash_chunk(trash);
|
||||||
|
}
|
||||||
/* error: call the release function and don't come back */
|
/* error: call the release function and don't come back */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user