diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2008-12-06 02:43:57 +0100 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2008-12-06 02:43:57 +0100 |
commit | 511cbc248423b34c26917aae257576090542dc97 (patch) | |
tree | fd570f17c691d1689c2b6bd06c452dd3f7550f15 /common | |
parent | cf03e1e566ef571e89335578799bd236a27a3966 (diff) | |
download | eurephia-511cbc248423b34c26917aae257576090542dc97.tar.gz eurephia-511cbc248423b34c26917aae257576090542dc97.tar.xz eurephia-511cbc248423b34c26917aae257576090542dc97.zip |
BUGFIX: Made some functions more nullsafe and fixed wrong function declaration in .h
Diffstat (limited to 'common')
-rw-r--r-- | common/eurephia_admin_common.c | 14 | ||||
-rw-r--r-- | common/eurephia_admin_common.h | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/common/eurephia_admin_common.c b/common/eurephia_admin_common.c index c49c1a3..3b02fe1 100644 --- a/common/eurephia_admin_common.c +++ b/common/eurephia_admin_common.c @@ -63,6 +63,10 @@ char *eAdminConvertSortKeys(eFieldMap *tfmap, const char *skeys_str) { char *cp = NULL, *tok = NULL, *delims = ","; static char sortkeys[8194]; + if( skeys_str == NULL ) { + return NULL; + } + // Make sure we have table field map assert( tfmap != NULL ); @@ -71,7 +75,7 @@ char *eAdminConvertSortKeys(eFieldMap *tfmap, const char *skeys_str) { assert( sk_map != NULL ); // Split up the skeys_str (sort keys string) and build up a map - cp = strdup(skeys_str); + cp = strdup_nullsafe(skeys_str); tok = strtok(cp, delims); memset(&sortkeys, 0, 8194); while( tok != NULL ) { @@ -104,11 +108,11 @@ eurephiaUSERINFO *eAdminPopulateUSERINFO(int uid, const char *uname, const char memset(newrec, 0, sizeof(eurephiaUSERINFO)+2); newrec->uid = uid; - newrec->username = strdup(uname); + newrec->username = strdup_nullsafe(uname); newrec->password = (pwd == NULL ? NULL : passwdhash(pwd)); - newrec->activated = strdup(activated); - newrec->deactivated = strdup(deactivd); - newrec->last_accessed = strdup(lastacc); + newrec->activated = strdup_nullsafe(activated); + newrec->deactivated = strdup_nullsafe(deactivd); + newrec->last_accessed = strdup_nullsafe(lastacc); newrec->next = NULL; return newrec; diff --git a/common/eurephia_admin_common.h b/common/eurephia_admin_common.h index 15fb3fd..450e700 100644 --- a/common/eurephia_admin_common.h +++ b/common/eurephia_admin_common.h @@ -111,7 +111,7 @@ eFieldMap eSortkeys_blacklist[] = { eFieldMap *eAdminGetTableMap(int table); -char *eAdminGetSortKey(int table, const char *str); +char *eAdminConvertSortKeys(eFieldMap *, const char *); eurephiaUSERINFO *eAdminPopulateUSERINFO(int uid, const char *uname, const char *pwd, const char *activated, const char *deactivd, const char *lastacc); |