From 64f8c425da20554e6909d969b8748076825ef601 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 30 Jun 2010 00:06:07 +0100 Subject: Strip whitespace in Twitter OAuth PIN responses. --- protocols/twitter/twitter.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'protocols') diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index ca57e51e..2e3ab634 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -268,7 +268,14 @@ static int twitter_buddy_msg( struct im_connection *ic, char *who, char *message if( set_getbool( &ic->acc->set, "oauth" ) && td->oauth_info && td->oauth_info->token == NULL ) { - if( !oauth_access_token( message, td->oauth_info ) ) + char pin[strlen(message)+1], *s; + + strcpy( pin, message ); + for( s = pin + sizeof( pin ) - 2; s > pin && isspace( *s ); s -- ) + *s = '\0'; + for( s = pin; *s && isspace( *s ); s ++ ) {} + + if( !oauth_access_token( s, td->oauth_info ) ) { imcb_error( ic, "OAuth error: %s", "Failed to send access token request" ); imc_logout( ic, TRUE ); -- cgit v1.2.3