summaryrefslogtreecommitdiff
path: root/fticks.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2011-04-05 11:15:56 +0200
committerLinus Nordberg <linus@nordu.net>2011-04-05 11:15:56 +0200
commita5b826ba0b67a9d9cc2baa51036a9a86170f8af7 (patch)
tree502508cc5aae3a94e4c739161574c3c5c9735ef8 /fticks.c
parentefccefde3e17d3202dff7714491ed85bcd56d371 (diff)
Don't crash in F-Ticks logging if we don't find User-Name.
Diffstat (limited to 'fticks.c')
-rw-r--r--fticks.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fticks.c b/fticks.c
index fd9a57d..724a589 100644
--- a/fticks.c
+++ b/fticks.c
@@ -146,8 +146,8 @@ fticks_log(const struct options *options,
const struct radmsg *msg,
const struct rqout *rqout)
{
- unsigned char *username = NULL;
- unsigned char *realm = NULL;
+ uint8_t *username = NULL;
+ uint8_t *realm = NULL;
uint8_t visinst[8+40+1+1]; /* Room for 40 octets of VISINST. */
uint8_t *macin = NULL;
uint8_t macout[2*32+1]; /* Room for ASCII representation of SHA256. */
@@ -155,12 +155,12 @@ fticks_log(const struct options *options,
username = radattr2ascii(radmsg_gettype(rqout->rq->msg,
RAD_Attr_User_Name));
if (username != NULL) {
- realm = (unsigned char *) strrchr((char *) username, '@');
+ realm = (uint8_t *) strrchr((char *) username, '@');
if (realm != NULL)
realm++;
- else
- realm = (unsigned char *) "";
}
+ if (realm == NULL)
+ realm = (uint8_t *) "";
memset(visinst, 0, sizeof(visinst));
if (options->fticks_reporting == RSP_FTICKS_REPORTING_FULL) {