vlvassilev / yuma123

The yuma123 repository
Other
24 stars 28 forks source link

yangcli segfaults when using large configs (> 8 MB) in "edit-config" command #137

Open AndreasHuebner-ae opened 1 year ago

AndreasHuebner-ae commented 1 year ago

I'm was playing around with yangcli 2.14.0 (master build from a month ago) and found it really useful as netconf cli frontend. While doing some performance tests with huge configurations, yangcli segfaulted when executing the "edit-config" command. (The size of the config xml file is around 30 MiB, so it is definitely not a common use case.)

Some debug info: The segfault happens when building the rpc in mgr_rpc_send_request(). scb->outbuff becomes invalid (NULL) in xml_wr_full_val() and ses_finish_msg() tries to deref it. (scb->outbuff->islast = TRUE;) scb->outbuff is set to NULL because there are no more buffers available. (see ses_msg_new_buff() + ses_msg_new_output_buff()) The return value ERR_NCX_RESOURCE_DENIED is not properly evaluated in the calling functions.

Default buffer size is 2000 and SES_MAX_BUFFERS is 4096, so I assume it will start segfaulting at around 8 MB.

I can of course just patch the code to allow more or larger buffers. But maybe someone wants to do a proper fix for this.

vlvassilev commented 1 year ago

Good catch. I have it on my list.