Merge pull request #174 from razzfazz/new_subscriber_uuid_cleanup
use sizeof() instead of hard-coded UUID length in newSubscriber()
This commit is contained in:
commit
66b087b9b1
|
@ -112,7 +112,7 @@ newSubscriber(const char * eventurl, const char * callback, int callbacklen)
|
||||||
/* TODO: improve that */
|
/* TODO: improve that */
|
||||||
strncpy(tmp->uuid, uuidvalue_igd, sizeof(tmp->uuid));
|
strncpy(tmp->uuid, uuidvalue_igd, sizeof(tmp->uuid));
|
||||||
tmp->uuid[sizeof(tmp->uuid)-1] = '\0';
|
tmp->uuid[sizeof(tmp->uuid)-1] = '\0';
|
||||||
snprintf(tmp->uuid+37, 5, "%04lx", random() & 0xffff);
|
snprintf(tmp->uuid+sizeof(tmp->uuid)-5, 5, "%04lx", random() & 0xffff);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue