From 3ea9847837af221d22494eebeb8b08826db0fb25 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Mon, 22 Dec 2014 19:45:39 +0100 Subject: [PATCH] The new base 64 encoder adds linebreaks, we need to remove them again for the list subscription tokens --- citadel/modules/listsub/serv_listsub.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/citadel/modules/listsub/serv_listsub.c b/citadel/modules/listsub/serv_listsub.c index 889926ac4..ada4bbadd 100644 --- a/citadel/modules/listsub/serv_listsub.c +++ b/citadel/modules/listsub/serv_listsub.c @@ -57,17 +57,21 @@ void listsub_generate_token(char *buf) { char sourcebuf[SIZ]; static int seq = 0; + size_t len; /* Theo, please sit down and shut up. This key doesn't have to be * tinfoil-hat secure, it just needs to be reasonably unguessable * and unique. */ - sprintf(sourcebuf, "%lx", + len = sprintf(sourcebuf, "%lx", (long) (++seq + getpid() + time(NULL)) ); /* Convert it to base64 so it looks cool */ - CtdlEncodeBase64(buf, sourcebuf, strlen(sourcebuf), 0); + len = CtdlEncodeBase64(buf, sourcebuf, len, 0); + if (buf[len - 1] == '\n') { + buf[len - 1] = '\0'; + } } const RoomNetCfg ActiveSubscribers[] = {listrecp, digestrecp}; -- 2.30.2