From 7e4717c18fc908c012326362eeed2b659dd734cf Mon Sep 17 00:00:00 2001 From: josch Date: Tue, 23 Sep 2014 19:30:50 +0200 Subject: [PATCH] mfconn_create: abort early on faulty input --- mfapi/mfconn.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mfapi/mfconn.c b/mfapi/mfconn.c index 37270b4..45a9752 100644 --- a/mfapi/mfconn.c +++ b/mfapi/mfconn.c @@ -42,6 +42,18 @@ mfconn *mfconn_create(const char *server, const char *username, mfconn *conn; int retval; + if (server == NULL) + return NULL; + + if (username == NULL) + return NULL; + + if (password == NULL) + return NULL; + + if (app_id < 0) + return NULL; + conn = (mfconn *) calloc(1, sizeof(mfconn)); conn->server = strdup(server);