@b4n commented on this pull request.


In updatechecker/src/updatechecker.c:

> @@ -185,15 +191,30 @@ version_compare(const gchar *current_version)
 }
 
 
-static void update_check_result_cb(SoupSession *session,
-    SoupMessage *msg, gpointer user_data)
+static gchar *bytes_to_string(GBytes *bytes)
+{
+    gsize bytes_size = g_bytes_get_size(bytes);
+    gchar *str = g_malloc(bytes_size + 1);
+    memcpy(str, g_bytes_get_data(bytes, NULL), bytes_size);

Yeah that's exactly the reason: the bytes have no reason to be NUL-terminated, as it's from reading the raw data from the webserver (and does not explicitly add a NUL itself from what I can gather). So this helper is to make it a C string, not really caring if there's a NUL earlier because a valid response won't have one anyway.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany-plugins/pull/1336/review/2022057949@github.com>