Skip to content

Commit 7954162

Browse files
lib/salt.c: gensalt(): Use STRTCPY() instead of its pattern
Signed-off-by: Alejandro Colomar <[email protected]>
1 parent 34bbd68 commit 7954162

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/salt.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "prototypes.h"
2828
#include "shadowlog.h"
2929
#include "string/strcmp/streq.h"
30+
#include "string/strcpy/strtcat.h"
3031

3132

3233
#if (defined CRYPT_GENSALT_IMPLEMENTS_AUTO_ENTROPY && \
@@ -443,12 +444,8 @@ static /*@observer@*/const char *gensalt (size_t salt_size)
443444

444445
return retval;
445446
#else /* USE_XCRYPT_GENSALT */
446-
/* Check if the result buffer is long enough. */
447-
assert (GENSALT_SETTING_SIZE > strlen (result) + salt_len);
448447

449-
/* Concatenate a pseudo random salt. */
450-
strncat (result, gensalt (salt_len),
451-
GENSALT_SETTING_SIZE - strlen (result) - 1);
448+
assert(STRTCAT(result, gensalt(salt_len)) != -1);
452449

453450
return result;
454451
#endif /* USE_XCRYPT_GENSALT */

0 commit comments

Comments
 (0)