Commit 2c4d9de
committed
session_client: fix segfault on NC_MSG_REPLY_ERR_MSGID
When retrieve_schema_data_getschema or build_schema_info_yl receive an
NC_MSG_REPLY_ERR_MSGID error, they do not call nc_recv_reply again to
receive the expected message.
However, when msg == NC_MSG_REPLY_ERR_MSGID, reply is necessarily NULL,
which causes a segfault when accessing the reply->type field.
Call nc_recv_reply again if we receive an NC_MSG_REPLY_ERR_MSGID error.
Also, nc_recv_reply may leave reply NULL for other reasons (NC_MSG_ERROR
is not the only case). Return an error if reply is NULL to avoid
potential further segfaults.
Signed-off-by: Robin Jarry <robin.jarry@6wind.com>1 parent 373a40a commit 2c4d9de
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
| 382 | + | |
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | | - | |
| 387 | + | |
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
| |||
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
713 | | - | |
| 713 | + | |
714 | 714 | | |
715 | 715 | | |
716 | 716 | | |
717 | | - | |
| 717 | + | |
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
| |||
0 commit comments