diff options
Diffstat (limited to 'src/iceauth.c')
-rw-r--r-- | src/iceauth.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/iceauth.c b/src/iceauth.c index 38500a5..dcee7ed 100644 --- a/src/iceauth.c +++ b/src/iceauth.c @@ -135,12 +135,10 @@ char **errorStringRet; if (!data) { - char *tempstr = + const char *tempstr = "Could not find correct MIT-MAGIC-COOKIE-1 authentication"; - *errorStringRet = (char *) malloc (strlen (tempstr) + 1); - if (*errorStringRet) - strcpy (*errorStringRet, tempstr); + *errorStringRet = strdup(tempstr); return (IcePoAuthFailed); } @@ -161,11 +159,10 @@ char **errorStringRet; * a single pass authentication method. */ - char *tempstr = "MIT-MAGIC-COOKIE-1 authentication internal error"; + const char *tempstr = + "MIT-MAGIC-COOKIE-1 authentication internal error"; - *errorStringRet = (char *) malloc (strlen (tempstr) + 1); - if (*errorStringRet) - strcpy (*errorStringRet, tempstr); + *errorStringRet = strdup(tempstr); return (IcePoAuthFailed); } @@ -226,11 +223,10 @@ char **errorStringRet; } else { - char *tempstr = "MIT-MAGIC-COOKIE-1 authentication rejected"; + const char *tempstr + = "MIT-MAGIC-COOKIE-1 authentication rejected"; - *errorStringRet = (char *) malloc (strlen (tempstr) + 1); - if (*errorStringRet) - strcpy (*errorStringRet, tempstr); + *errorStringRet = strdup(tempstr); stat = IcePaAuthRejected; } @@ -246,12 +242,10 @@ char **errorStringRet; * always find a valid entry. */ - char *tempstr = + const char *tempstr = "MIT-MAGIC-COOKIE-1 authentication internal error"; - *errorStringRet = (char *) malloc (strlen (tempstr) + 1); - if (*errorStringRet) - strcpy (*errorStringRet, tempstr); + *errorStringRet = strdup(tempstr); return (IcePaAuthFailed); } |