From: nekral-guest Date: Sun, 6 Jan 2008 13:49:00 +0000 (+0000) Subject: Set the method string as a constant string. X-Git-Tag: 4.1.1~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5b79877640252a32f61d635e638e07e749b1fd9;p=thirdparty%2Fshadow.git Set the method string as a constant string. --- diff --git a/ChangeLog b/ChangeLog index 0c92e18d1..24ad6b2ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-01-06 Nicolas François + + * lib/encrypt.c: Set the method string as a constant string. + 2008-01-06 Nicolas François * lib/port.c: Assume declares errno. diff --git a/lib/encrypt.c b/lib/encrypt.c index eda9713fd..9a880e83b 100644 --- a/lib/encrypt.c +++ b/lib/encrypt.c @@ -54,7 +54,7 @@ char *pw_encrypt (const char *clear, const char *salt) * supported, and return a DES encrypted password. */ if (salt && salt[0] == '$' && strlen (cp) <= 13) { - char *method = "$1$"; + const char *method; switch (salt[1]) { case '1': @@ -67,7 +67,11 @@ char *pw_encrypt (const char *clear, const char *salt) method = "SHA512"; break; default: - method[1] = salt[1]; + { + static char nummethod[4] = "$x$"; + nummethod[1] = salt[1]; + method = &nummethod[0]; + } } fprintf (stderr, _("crypt method not supported by libcrypt? (%s)\n"),