[BACK]Return to misc.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/misc.c between version 1.157 and 1.158

version 1.157, 2020/12/22 00:12:22 version 1.158, 2021/01/11 02:12:57
Line 497 
Line 497 
  *   *
  * Return -1 if time string is invalid.   * Return -1 if time string is invalid.
  */   */
 long  int
 convtime(const char *s)  convtime(const char *s)
 {  {
         long total, secs, multiplier;          long total, secs, multiplier;
Line 514 
Line 514 
         while (*p) {          while (*p) {
                 secs = strtol(p, &endp, 10);                  secs = strtol(p, &endp, 10);
                 if (p == endp ||                  if (p == endp ||
                     (errno == ERANGE && (secs == LONG_MIN || secs == LONG_MAX)) ||                      (errno == ERANGE && (secs == INT_MIN || secs == INT_MAX)) ||
                     secs < 0)                      secs < 0)
                         return -1;                          return -1;
   
Line 545 
Line 545 
                 default:                  default:
                         return -1;                          return -1;
                 }                  }
                 if (secs >= LONG_MAX / multiplier)                  if (secs >= INT_MAX / multiplier)
                         return -1;                          return -1;
                 secs *= multiplier;                  secs *= multiplier;
                 if  (total >= LONG_MAX - secs)                  if  (total >= INT_MAX - secs)
                         return -1;                          return -1;
                 total += secs;                  total += secs;
                 if (total < 0)                  if (total < 0)

Legend:
Removed from v.1.157  
changed lines
  Added in v.1.158