Commit 55998d8c authored by 's avatar
Browse files

Added inclusion of mapi_errors.h in anonymize.c

Fixed a potential heap overflow error in mapi_authenticate().


git-svn-id: file:///home/svn/mapi/trunk@563 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 6faafa64
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "mapiipc.h" #include "mapiipc.h"
#include "anonymization.h" #include "anonymization.h"
#include "../stdlib/cooking.h" #include "../stdlib/cooking.h"
#include "mapi_errors.h"
#include "names.h" #include "names.h"
extern char *anonnames[]; extern char *anonnames[];
......
...@@ -2651,10 +2651,10 @@ int mapi_authenticate(int fd, const char *username, const char *password, const ...@@ -2651,10 +2651,10 @@ int mapi_authenticate(int fd, const char *username, const char *password, const
{ {
case AUTHENTICATE_ACK: case AUTHENTICATE_ACK:
rflow->is_authenticated = 1; rflow->is_authenticated = 1;
rflow->username = malloc(sizeof(char) * strlen(username)); rflow->username = malloc(sizeof(char) * (strlen(username) + 1));
rflow->vo = malloc(sizeof(char) * strlen(vo)); rflow->vo = malloc(sizeof(char) * (strlen(vo) + 1));
strncpy(rflow->username, username, MAX_DATA_SIZE); snprintf(rflow->username, MAX_DATA_SIZE, "%s", username);
strncpy(rflow->vo, vo, MAX_DATA_SIZE); snprintf(rflow->vo, MAX_DATA_SIZE, "%s", vo);
return(0); return(0);
break; break;
case ERROR_ACK: case ERROR_ACK:
...@@ -2675,7 +2675,6 @@ int mapi_authenticate(int fd, const char *username, const char *password, const ...@@ -2675,7 +2675,6 @@ int mapi_authenticate(int fd, const char *username, const char *password, const
{ {
/* /*
* Now what? * Now what?
* TODO: Check with the gurus.
*/ */
return(0); return(0);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment