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:
Thomas BERNARD 2015-12-13 00:32:01 +01:00
commit 66b087b9b1
1 changed files with 1 additions and 1 deletions

View File

@ -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;
} }