From: L. Alberto Giménez Date: Thu, 3 Feb 2011 21:26:43 +0000 (+0100) Subject: Fix a segfault when specifying an invalid host. X-Git-Url: https://git.toastfreeware.priv.at/gregoa/bti.git/commitdiff_plain/03e07fdb619f5708c5d015ec080f4d777b405603?hp=7276d1a65c88b46879b1c253b3dd83673c9f34c0 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. --- 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);