Changeset 37165


Ignore:
Timestamp:
2013-07-04T15:31:32+02:00 (5 years ago)
Author:
blogic
Message:

px5g: creates certificates that expire in the past

the attached patch fixes a bug of px5g when instructed to build
certificates that expire after 2038-01-19, caused a multiplication that
may overflow the "to" variable of type time_t

Attached patch checks if "to" precedes "from": if so sets "to" to its
maximum value. Pretty rude, but works well even if certificate is set to
expire in a century

Signed-off-by: Federico Fissore <federico@…>
Patchork: http://patchwork.openwrt.org/patch/3749/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/utils/px5g/src/px5g.c

    r37007 r37165  
    2323#include <string.h> 
    2424#include <time.h> 
     25#include <limits.h> 
    2526#include "polarssl/havege.h" 
    2627#include "polarssl/bignum.h" 
     
    158159        strftime(fstr, sizeof(fstr), "%F %H:%M:%S", gmtime(&from)); 
    159160        to = from + 60 * 60 * 24 * days; 
     161        if (to < from) 
     162                to = INT_MAX; 
    160163        strftime(tstr, sizeof(tstr), "%F %H:%M:%S", gmtime(&to)); 
    161164 
Note: See TracChangeset for help on using the changeset viewer.