aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--irc_im.c4
-rw-r--r--lib/oauth2.c10
-rw-r--r--protocols/jabber/jabber.c2
-rw-r--r--unix.c20
4 files changed, 28 insertions, 8 deletions
diff --git a/irc_im.c b/irc_im.c
index 58cf2667..ae75fad1 100644
--- a/irc_im.c
+++ b/irc_im.c
@@ -49,7 +49,7 @@ static gboolean bee_irc_user_new(bee_t *bee, bee_user_t *bu)
char nick[MAX_NICK_LENGTH + 1], *s;
memset(nick, 0, MAX_NICK_LENGTH + 1);
- strcpy(nick, nick_get(bu));
+ strncpy(nick, nick_get(bu), MAX_NICK_LENGTH);
bu->ui_data = iu = irc_user_new(irc, nick);
iu->bu = bu;
@@ -722,6 +722,8 @@ static gboolean bee_irc_chat_invite(bee_t *bee, bee_user_t *bu, const char *name
if (irc_channel_by_name(irc, s) == NULL) {
g_free(channel);
channel = s;
+ } else {
+ g_free(s);
}
}
diff --git a/lib/oauth2.c b/lib/oauth2.c
index d6cf9a53..f9acd6c8 100644
--- a/lib/oauth2.c
+++ b/lib/oauth2.c
@@ -139,9 +139,15 @@ static void oauth2_access_token_done(struct http_request *req)
{
struct oauth2_access_token_data *cb_data = req->data;
char *atoken = NULL, *rtoken = NULL, *error = NULL;
- char *content_type;
+ char *content_type = NULL;
- if (getenv("BITLBEE_DEBUG") && req->reply_body) {
+ if (req->status_code <= 0 && !req->reply_body) {
+ cb_data->func(cb_data->data, NULL, NULL, req->status_string);
+ g_free(cb_data);
+ return;
+ }
+
+ if (getenv("BITLBEE_DEBUG")) {
printf("%s\n", req->reply_body);
}
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index 2db026cd..04db365e 100644
--- a/protocols/jabber/jabber.c
+++ b/protocols/jabber/jabber.c
@@ -427,7 +427,7 @@ static void jabber_get_info(struct im_connection *ic, char *who)
bud = bud->next;
}
- jabber_get_vcard(ic, bud ? bud->full_jid : who);
+ jabber_get_vcard(ic, who);
}
static void jabber_set_away(struct im_connection *ic, char *state_txt, char *message)
diff --git a/unix.c b/unix.c
index ada2cc9d..30451241 100644
--- a/unix.c
+++ b/unix.c
@@ -211,15 +211,25 @@ static int crypt_main(int argc, char *argv[])
" %s -x chkhash <hashed password> <cleartext password>\n",
argv[0], argv[0], argv[0], argv[0], argv[0]);
} else if (strcmp(argv[2], "enc") == 0) {
- pass_len = arc_encode(argv[4], strlen(argv[4]), (unsigned char **) &pass_cr, argv[3], 12);
- printf("%s\n", base64_encode(pass_cr, pass_len));
+ char *encoded;
+
+ pass_len = arc_encode(argv[4], strlen(argv[4]), &pass_cr, argv[3], 12);
+
+ encoded = base64_encode(pass_cr, pass_len);
+ printf("%s\n", encoded);
+ g_free(encoded);
+ g_free(pass_cr);
} else if (strcmp(argv[2], "dec") == 0) {
- pass_len = base64_decode(argv[4], (unsigned char **) &pass_cr);
+ pass_len = base64_decode(argv[4], &pass_cr);
arc_decode(pass_cr, pass_len, (char **) &pass_cl, argv[3]);
printf("%s\n", pass_cl);
+
+ g_free(pass_cr);
+ g_free(pass_cl);
} else if (strcmp(argv[2], "hash") == 0) {
md5_byte_t pass_md5[21];
md5_state_t md5_state;
+ char *encoded;
random_bytes(pass_md5 + 16, 5);
md5_init(&md5_state);
@@ -227,7 +237,9 @@ static int crypt_main(int argc, char *argv[])
md5_append(&md5_state, pass_md5 + 16, 5); /* Add the salt. */
md5_finish(&md5_state, pass_md5);
- printf("%s\n", base64_encode(pass_md5, 21));
+ encoded = base64_encode(pass_md5, 21);
+ printf("%s\n", encoded);
+ g_free(encoded);
} else if (strcmp(argv[2], "unhash") == 0) {
printf("Hash %s submitted to a massive Beowulf cluster of\n"
"overclocked 486s. Expect your answer next year somewhere around this time. :-)\n", argv[3]);