aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/twitter/twitter.c
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2016-01-28 04:14:06 +0100
committerMarius Halden <marius.h@lden.org>2016-05-07 14:27:54 +0200
commit35648353ff877344d577e9247ee6f8cfa15ed940 (patch)
treea31d3c5c9ad275e07f01aa9bfd1a619b0a1cd346 /protocols/twitter/twitter.c
parent261a20494e1214aad567c87d71ca827ac8ca6081 (diff)
Better error checking
Diffstat (limited to 'protocols/twitter/twitter.c')
-rw-r--r--protocols/twitter/twitter.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c
index 2cac166f..76625b3d 100644
--- a/protocols/twitter/twitter.c
+++ b/protocols/twitter/twitter.c
@@ -317,7 +317,7 @@ struct groupchat *twitter_groupchat_init(struct im_connection *ic)
tmp = set_getstr(&ic->acc->set, "channel_name");
- if (tmp == NULL) {
+ if (tmp == NULL || strlen(tmp) == 0) {
name_hint = g_strdup_printf("%s_%s", td->prefix, ic->acc->user);
} else {
name_hint = g_strdup(tmp);
@@ -527,7 +527,19 @@ static char *set_eval_commands(set_t * set, char *value)
static char *set_eval_channel_name(set_t * set, char *value)
{
- return value; // XXX: Validate somethig here?
+ size_t len;
+
+ if (value == NULL) {
+ return NULL;
+ }
+
+ len = strlen(value);
+
+ if (len < MAX_NICK_LENGTH && len > 0) {
+ return value;
+ } else {
+ return NULL;
+ }
}
static char *set_eval_mode(set_t * set, char *value)