check sidlen before string compare

This commit is contained in:
Thomas Bernard 2012-05-01 11:57:20 +02:00
parent 4edb1c03ce
commit 57a06974bf
1 changed files with 2 additions and 2 deletions

View File

@ -140,7 +140,7 @@ renewSubscription(const char * sid, int sidlen, int timeout)
{
struct subscriber * sub;
for(sub = subscriberlist.lh_first; sub != NULL; sub = sub->entries.le_next) {
if(memcmp(sid, sub->uuid, 41) == 0) {
if((sidlen == 41) && (memcmp(sid, sub->uuid, 41) == 0)) {
sub->timeout = (timeout ? time(NULL) + timeout : 0);
return 0;
}
@ -155,7 +155,7 @@ upnpevents_removeSubscriber(const char * sid, int sidlen)
if(!sid)
return -1;
for(sub = subscriberlist.lh_first; sub != NULL; sub = sub->entries.le_next) {
if(memcmp(sid, sub->uuid, 41) == 0) {
if((sidlen == 41) && (memcmp(sid, sub->uuid, 41) == 0)) {
if(sub->notify) {
sub->notify->sub = NULL;
}