1. 19 Jan, 2011 3 commits
  2. 18 Jan, 2011 1 commit
  3. 13 Jan, 2011 1 commit
  4. 12 Jan, 2011 1 commit
  5. 11 Jan, 2011 10 commits
  6. 10 Jan, 2011 1 commit
  7. 08 Jan, 2011 5 commits
  8. 07 Jan, 2011 4 commits
  9. 06 Jan, 2011 4 commits
  10. 05 Jan, 2011 1 commit
  11. 03 Jan, 2011 2 commits
  12. 01 Jan, 2011 7 commits
    • Moe Jette's avatar
      c5911e61
    • Moe Jette's avatar
      Patch from Gerrit: 09_hostlist__hostlist_deranged_string.diff · 8274e453
      Moe Jette authored
      hostlist_deranged_string(): test for overflow
      			    
      This builds upon the preceding patch, exploiting that hostrange_to_string()
       * returns >= 0 when it has terminated the string with '\0', where  either 
         - n == 0 and it has not written anything or
         - it has written at most n > 0 characters, indicated by returning  n-1 >= 0;
       * returns a negative value to indicate truncation.
      
      Hence hostrange_deranged_string() changed as follows:
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       * added 'len < n' as loop condition, to catch the case 'n == 0'
         (also exploiting that NUL-termination is only needed on error);
       * separator now is inserted after all non-first elements
         (to avoid having to undo the last separator);
       * as in preceding patch, replaced 'truncated' variable by a jump label.
      8274e453
    • Moe Jette's avatar
      patch from Gerrit: 08_hostlist__hostrange_to_string.diff · e2bc04b5
      Moe Jette authored
      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).
      e2bc04b5
    • Moe Jette's avatar
      patch from Gerrit: 07_hostlist__hostrange_pop__hostrange_shift.diff · a9f9ff68
      Moe Jette authored
      hostrange_pop()/hostrange_shift(): test for overflow
      
      hostrange_pop():				   
       * retrofitted out_of_memory() test after strdup;
       * tested for negative length/overflow before the while-loop,
         making sure that 'dims' characters also fit in;
       * second snprintf is not tested.
      
      hostrange_shift(): 
       * analogous changes (second snprintf also not tested). 
      a9f9ff68
    • Moe Jette's avatar
      Patch from Gerrit: 06_hostlist__host_prefix_end.diff · c5918ee9
      Moe Jette authored
      host_prefix_end(): save variable, factor out common expressions
      
      This saves one variable and factors out the condition common
      to the if/else branches.06_hostlist__host_prefix_end.diff
      
       * return type of strlen is unsigned (size_t), hence strlen(hostname) >= 0;
       * both while-loops require idx >= 0, hence -1 is returned
         if strlen(hostname) == 0.
      c5918ee9
    • Moe Jette's avatar
      Patch from Gerrit: 05_hostlist__get_bracketed_list.diff · 951861bb
      Moe Jette authored
      _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'.
      951861bb
    • Moe Jette's avatar
      Patch from Gerrit: 04_hostlist__hostrange_numstr.diff · ae7ce172
      Moe Jette authored
      hostrange_numstr(): overflow cases
      
      This checks hostrange_numstr() for overflow cases:		    
       * requires n > dims (if dims=1, min 1 digit, else dim + '\0' digits);
         - this precondition simplifies many subsequent checks and
         - addresses if (len == n) then len++ means buf[len] = buf[n];
       * also checks return value of the snprintfs.
      ae7ce172