On 08/31/14 11:11 AM, Matthieu Herrb wrote:
Even though this use was safe, some linkers produce a warning when strcpy() is used, and this is the only use in libSM. --- src/sm_genid.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)diff --git src/sm_genid.c src/sm_genid.c index ec2e668..9535cd1 100644 --- src/sm_genid.c +++ src/sm_genid.c @@ -110,16 +110,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);
Reviewed-by: Alan Coopersmith <[email protected]> -- -Alan Coopersmith- [email protected] Oracle Solaris Engineering - http://blogs.oracle.com/alanc _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
