mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 09:57:41 +00:00
Fix potential infinite loop when trying to format long lines.
This commit is contained in:
parent
5f45fd907b
commit
ada7d43825
@ -68,8 +68,12 @@ sub fmt_depend {
|
||||
if ($off != 0) {
|
||||
$ret .= ' ' x $indent;
|
||||
$pos = rindex($deps, ' ', $off + 80 - $indent - 2);
|
||||
if ($pos <= $off) {
|
||||
# No space found within 78 columns, check beyond
|
||||
$pos = index($deps, ' ', $off + 80 - $indent - 2);
|
||||
}
|
||||
} else {
|
||||
$pos = rindex($deps, ' ', $off + 78);
|
||||
$pos = rindex($deps, ' ', 78);
|
||||
}
|
||||
$ret .= substr($deps, $off, $pos - $off) . " \\\n";
|
||||
$off = $pos + 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user