aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-06-08 00:25:18 -0300
committerdequis <dx@dxzone.com.ar>2015-06-08 00:25:18 -0300
commit61e7e02096c7910addba32a9060a5e0cba68284b (patch)
tree5ab64f1013236cb0198b375b422f909716920286
parent56c8a4f1967a6529f1575082ae744c1ed14be412 (diff)
twitter: fix leak of the letter "s" in twitter_url_len_diff
Yeah, just the letter s from "https", and a null byte. Really critical stuff. You'd have to post a million tweets to even notice this at all.
-rw-r--r--protocols/twitter/twitter.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c
index 8c7e5ea9..7eb948ad 100644
--- a/protocols/twitter/twitter.c
+++ b/protocols/twitter/twitter.c
@@ -468,11 +468,15 @@ int twitter_url_len_diff(gchar *msg, unsigned int target_len)
g_regex_match(regex, msg, 0, &match_info);
while (g_match_info_matches(match_info)) {
- gchar *url = g_match_info_fetch(match_info, 2);
+ gchar *s, *url;
+
+ url = g_match_info_fetch(match_info, 2);
url_len_diff += target_len - g_utf8_strlen(url, -1);
+
/* Add another character for https://t.co/... URLs */
- if (g_match_info_fetch(match_info, 3) != NULL) {
+ if ((s = g_match_info_fetch(match_info, 3))) {
url_len_diff += 1;
+ g_free(s);
}
g_free(url);
g_match_info_next(match_info, NULL);