1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

address security concerns in persistence

This commit is contained in:
rogday
2022-04-13 22:45:43 +03:00
committed by Smirnov Egor
parent 03c9648f2e
commit 7daf84fb44
2 changed files with 22 additions and 1 deletions
+1 -1
View File
@@ -817,7 +817,7 @@ char *FileStorage::Impl::gets(size_t maxCount) {
int delta = (int) strlen(ptr);
ofs += delta;
maxCount -= delta;
if (ptr[delta - 1] == '\n' || maxCount == 0)
if (delta == 0 || ptr[delta - 1] == '\n' || maxCount == 0)
break;
if (delta == count)
buffer.resize((size_t) (buffer.size() * 1.5));