Fix the HAVE_UUID_CREATE code now that its gets used:

- fix temp declaration
- use snprintf instread of strcpy()
This commit is contained in:
matthieu 2014-08-31 17:57:40 +00:00
parent f046325ef3
commit 17de6442e2

View File

@ -107,19 +107,18 @@ SmsGenerateClientID(SmsConn smsConn)
{
#if defined(HAVE_UUID_CREATE)
char *id;
char **temp;
char *temp;
uuid_t uuid;
uint32_t status;
size_t len;
uuid_create(&uuid, &status);
uuid_to_string(&uuid, &temp, &status);
if ((id = malloc (strlen (temp) + 2)) != NULL)
{
id[0] = '2';
strcpy (id+1, temp);
}
len = strlen(temp) + 2;
if ((id = malloc(len)) != NULL)
snprintf(id, len, "2%s", temp);
free(temp);