Commit 951861bb authored by Moe Jette's avatar Moe Jette
Browse files

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'.
parent ae7ce172
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment