[librest] oauth: fix payload



commit 7766d718735270d1c0850685a3c7655a5726d60f
Author: Günther Wagner <info gunibert de>
Date:   Tue Jan 11 22:15:47 2022 +0100

    oauth: fix payload
    
    Due to the change to soup3 we save the payload now as GBytes.
    The trailing '\0' is not part of that and therefore one has
    to create a full string afterwards.

 rest/oauth-proxy-call.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/rest/oauth-proxy-call.c b/rest/oauth-proxy-call.c
index e238c3c..b292cad 100644
--- a/rest/oauth-proxy-call.c
+++ b/rest/oauth-proxy-call.c
@@ -339,6 +339,7 @@ oauth_proxy_call_parse_token_response (OAuthProxyCall *call)
   OAuthProxyPrivate *priv;
   GHashTable *form;
   OAuthProxy *proxy;
+  g_autofree gchar *formstr = NULL;
 
   /* TODO: sanity checks, error handling, probably return gboolean */
 
@@ -349,7 +350,8 @@ oauth_proxy_call_parse_token_response (OAuthProxyCall *call)
   g_object_unref (proxy);
   g_assert (priv);
 
-  form = soup_form_decode (rest_proxy_call_get_payload (REST_PROXY_CALL (call)));
+  formstr = g_strndup (rest_proxy_call_get_payload (REST_PROXY_CALL (call)), 
rest_proxy_call_get_payload_length (REST_PROXY_CALL (call)));
+  form = soup_form_decode (formstr);
 
   g_free (priv->token);
   g_free (priv->token_secret);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]