Fixed: Reading in a yang-spec file exactly the same size as the buffer (1024/2048/4096/...) could leave the buffer not terminated with a 0 byte

This commit is contained in:
Olof hagsand 2020-06-18 09:54:51 +02:00
parent 0adcd94f3f
commit fade9dcfd5
3 changed files with 757 additions and 1 deletions

View file

@ -554,7 +554,7 @@ yang_parse_file(int fd,
}
if (ret == 0)
break; /* eof */
if (len==i){
if (i == len-1){
if ((buf = realloc(buf, 2*len)) == NULL){
clicon_err(OE_XML, errno, "realloc");
goto done;