summaryrefslogtreecommitdiff
path: root/src/sm_genid.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sm_genid.c')
-rw-r--r--src/sm_genid.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/sm_genid.c b/src/sm_genid.c
index 2500fcf..1a8b9a0 100644
--- a/src/sm_genid.c
+++ b/src/sm_genid.c
@@ -111,16 +111,15 @@ SmsGenerateClientID(SmsConn smsConn)
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);