From: Egor Date: Fri, 13 Jun 2025 04:49:16 +0000 (+0300) Subject: passwd: don't use strcpy X-Git-Url: https://git.patchysicp.xyz/?a=commitdiff_plain;h=2da94a8c305414d1aa4514585d4d085ca42f0dae;p=patchyircd.git passwd: don't use strcpy --- diff --git a/src/crypt_blowfish.cpp b/src/crypt_blowfish.cpp index f45f65a..1aab096 100644 --- a/src/crypt_blowfish.cpp +++ b/src/crypt_blowfish.cpp @@ -807,5 +807,5 @@ char *crypt_blowfish(const char *key, const char *setting, char *output) if (ok && retval) return retval; - return strcpy(output, "*"); + return (char *)memcpy(output, "*", 2); } diff --git a/src/crypt_blowfish.h b/src/crypt_blowfish.h index 231a66c..7b7c7b9 100644 --- a/src/crypt_blowfish.h +++ b/src/crypt_blowfish.h @@ -1,4 +1,7 @@ // Copyright (c) 1998-2014 Solar Designer // Copyright (c) 2005-2020 Rich Felker, et al. // SPDX-License-Identifier: MIT +#ifndef CRYPT_BLOWFISH_H_ +#define CRYPT_BLOWFISH_H_ char *crypt_blowfish(const char *key, const char *setting, char *output); +#endif diff --git a/src/passwd.cpp b/src/passwd.cpp index 018b4e0..632f74e 100644 --- a/src/passwd.cpp +++ b/src/passwd.cpp @@ -11,7 +11,7 @@ char *password_crypt(const char *key, const char *setting) if (setting[0] == '$' && setting[1] == '2' && setting[3] == '$') return crypt_blowfish(key, setting, output); else - return strcpy(output, "*"); + return (char *)memcpy(output, "*", 2); } char *password_hash2(const char *pw, int algo, int strength) {