In recvauth_common, convert a use of strcpy to strdup
authorGreg Hudson <ghudson@mit.edu>
Mon, 11 May 2009 22:46:56 +0000 (22:46 +0000)
committerGreg Hudson <ghudson@mit.edu>
Mon, 11 May 2009 22:46:56 +0000 (22:46 +0000)
ticket: 6200
status: open

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22343 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/recvauth.c

index 2f56e567d78c9e1eacd4cbe2cd7e51b1e0eef3e1..611546aa5b0e20c9e6f75ac0edf43ff029921db6 100644 (file)
@@ -173,11 +173,11 @@ recvauth_common(krb5_context context,
                error.error = KRB_ERR_GENERIC;
        message = error_message(problem);
        error.text.length  = strlen(message) + 1;
-       if (!(error.text.data = malloc(error.text.length))) {
+       error.text.data = strdup(message);
+       if (!error.text.data) {
            retval = ENOMEM;
            goto cleanup;
        }
-       strcpy(error.text.data, message);
        if ((retval = krb5_mk_error(context, &error, &outbuf))) {
            free(error.text.data);
            goto cleanup;