View previous topic :: View next topic |
Author |
Message |
Padavan
Joined: 24 Feb 2012 Posts: 2 Location: Russia
|
Posted: Fri Feb 24, 2012 1:13 pm Post subject: Serious bug on read forwards from lease file |
|
|
miniupnpd cannot correct read forwards from lease file.
1) read field "iport" instead of "timestamp" (bad timestamp input from file)
2) leaseduration always negative and NAT-PMP forwards with non-null timestamp always deleted.
miniupnpd version 1.6.20120207 (and earler)
source file
upnpredirect.c
function
int reload_from_lease_file()
Code: |
iport = (unsigned short)atoi(p); // !!! exchange timestamp and iport bug. Padavan fixed
p = strchr(p, ':');
if(!p) {
syslog(LOG_ERR, "unrecognized data in lease file");
continue;
}
*(p++) = '\0';
desc = strchr(p, ':');
if(!desc) {
syslog(LOG_ERR, "unrecognized data in lease file");
continue;
}
*(desc++) = '\0';
timestamp = (unsigned int)atoi(p); // !!! exchange timestamp and iport bug. Padavan fixed
/* trim description */
while(isspace(*desc))
desc++;
p = desc;
while(*(p+1))
p++;
while(isspace(*p) && (p > desc))
*(p--) = '\0';
if(timestamp > 0) {
if(timestamp <= current_time) {
syslog(LOG_NOTICE, "already expired lease in lease file");
continue;
} else {
leaseduration = timestamp - current_time; // !!! always negative leaseduration. Padavan fixed
}
} else {
leaseduration = 0; /* default value */
}
|
|
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
|
Back to top |
|
|
Padavan
Joined: 24 Feb 2012 Posts: 2 Location: Russia
|
Posted: Tue Mar 06, 2012 3:38 pm Post subject: |
|
|
miniupnp
Thanks! |
|
Back to top |
|
|
|