Patch from Gerrit: 05_hostlist__get_bracketed_list.diff
_get_bracketed_list(): simplify and look for overflow conditions * initial test requires that len + 4 < n, - this ensures enough space for '[', ']', one digit and '\0', - simplifies many subsequent tests (e.g. for bracket_needed); * loop has been reorganized: - pre-condition: len + 3 < n - loop run-condition: len < n-1 - post-condition: len < n-1 (otherwise, it returns n); * therefore len < n after adding ']' * and thus len < n when calling buf[len] = '\0'.
Please register or sign in to comment