mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Just by allocating size*2 bytes we can't be sure that new size will be enough,
so change two
if (size not enough) {
reallocf(size*2);
}
into
while (size not enough) {
reallocf(size*2);
}
This commit is contained in:
parent
b1c53bc9c0
commit
323d07b497
1 changed files with 2 additions and 2 deletions
|
|
@ -157,7 +157,7 @@ getcwd(pt, size)
|
|||
* as necessary. Max length is 3 for "../", the largest
|
||||
* possible component name, plus a trailing NUL.
|
||||
*/
|
||||
if (bup + 3 + MAXNAMLEN + 1 >= eup) {
|
||||
while (bup + 3 + MAXNAMLEN + 1 >= eup) {
|
||||
if ((up = reallocf(up, upsize *= 2)) == NULL)
|
||||
goto err;
|
||||
bup = up;
|
||||
|
|
@ -211,7 +211,7 @@ getcwd(pt, size)
|
|||
* Check for length of the current name, preceding slash,
|
||||
* leading slash.
|
||||
*/
|
||||
if (bpt - pt < dp->d_namlen + (first ? 1 : 2)) {
|
||||
while (bpt - pt < dp->d_namlen + (first ? 1 : 2)) {
|
||||
size_t len, off;
|
||||
|
||||
if (!ptsize) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue