From 03e07fdb619f5708c5d015ec080f4d777b405603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=2E=20Alberto=20Gim=C3=A9nez?= Date: Thu, 3 Feb 2011 22:26:43 +0100 Subject: [PATCH] Fix a segfault when specifying an invalid host. If the --host argument did not contain a valid hostname to contact to, a segmentation fault was raised because the return value from oauth_http_post and oauth_http_get was not being properly checked. --- bti.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bti.c b/bti.c index f6479f8..17a2a93 100644 --- a/bti.c +++ b/bti.c @@ -724,6 +724,11 @@ static int send_request(struct session *session) free(req_url); } + if (!reply) { + fprintf(stderr, "Error retrieving from URL (%s)\n", endpoint); + return 1; + } + if ((session->action != ACTION_UPDATE) && (session->action != ACTION_RETWEET)) parse_timeline(reply, session);