]> PatchyGit - patchyircd.git/commitdiff
passwd: don't use strcpy
authorEgor <egor@patchysicp.xyz>
Fri, 13 Jun 2025 04:49:16 +0000 (07:49 +0300)
committerEgor <egor@patchysicp.xyz>
Fri, 13 Jun 2025 04:49:16 +0000 (07:49 +0300)
src/crypt_blowfish.cpp
src/crypt_blowfish.h
src/passwd.cpp

index f45f65a..1aab096 100644 (file)
@@ -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);
 }
index 231a66c..7b7c7b9 100644 (file)
@@ -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
index 018b4e0..632f74e 100644 (file)
@@ -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)
 {