Commit e2bc04b5 authored by Moe Jette's avatar Moe Jette
Browse files

patch from Gerrit: 08_hostlist__hostrange_to_string.diff

hostrange_to_string(): truncation checks

 * turned 'truncated' variable into jump label;
 * loop changes so that the pre-condition is always len < n:
   - if len >= n inside the loop, the a jump to 'truncated' follows,
   - hence loop post-condition is also len < n, so that buf[len] = '\0' works;
 * consistently check ret=snprintf() for "ret < 0 || (len += ret) >= n",
   - if dims > 1, also tests to ensure that len + dims < n,
   - further overflow test after incrementing len for  separator;
 * moved separator test up (inserted when i > hr->lo)
   (to avoid having to undo the last separator).
parent a9f9ff68
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