diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-10-20 04:34:03 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-10-20 04:34:03 +0000 |
commit | 0b3824c86a99354d06339b95e40515de762d65f7 (patch) | |
tree | 133edb1fb478a97674cb63e1f89a4762053d24e2 /src/core/enc_none.c | |
parent | 0d3ec454de486da5cbc292f7e694ee8ab7e4fae0 (diff) |
Apply some changes based on possible "flaws" found with flawfinder.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2574 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core/enc_none.c')
-rw-r--r-- | src/core/enc_none.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/core/enc_none.c b/src/core/enc_none.c index 7f38d8532..91784bca4 100644 --- a/src/core/enc_none.c +++ b/src/core/enc_none.c @@ -25,26 +25,25 @@ class ENone : public Module ModuleManager::Attach(I_OnCheckPassword, this); } - EventReturn OnEncrypt(const char *src,int len,char *dest,int size) + EventReturn OnEncrypt(const char *src,int len,char *dest,int size) { - if(size>=len) + if(size>=len) { memset(dest,0,size); - strncpy(dest,src,len); - dest[len] = '\0'; - return EVENT_ALLOW; + strlcpy(dest,src,len); + return EVENT_ALLOW; } return EVENT_STOP; } - EventReturn OnEncryptInPlace(char *buf, int size) + EventReturn OnEncryptInPlace(char *buf, int size) { return EVENT_ALLOW; } - EventReturn OnEncryptCheckLen(int passlen, int bufsize) + EventReturn OnEncryptCheckLen(int passlen, int bufsize) { - if(bufsize>=passlen) + if(bufsize>=passlen) { return EVENT_ALLOW; } @@ -53,13 +52,12 @@ class ENone : public Module EventReturn OnDecrypt(const char *src, char *dest, int size) { memset(dest,0,size); - strncpy(dest,src,size); - dest[size] = '\0'; + strlcpy(dest,src,size); return EVENT_ALLOW; } EventReturn OnCheckPassword(const char *plaintext, const char *password) { - if(strcmp(plaintext,password)==0) + if(strcmp(plaintext,password)==0) { return EVENT_ALLOW; } |