summaryrefslogtreecommitdiff
path: root/src/plugins/relay
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-03-31 21:03:56 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-04-07 13:18:13 +0200
commit64db1b958dbf9a21ae67a0829b74eb20be3ff697 (patch)
tree84f2799bee473311ab06bcf01f44345dfbc53ffa /src/plugins/relay
parentcb785d5035b88e63f356726f6f50039617f8c5c5 (diff)
downloadweechat-64db1b958dbf9a21ae67a0829b74eb20be3ff697.zip
relay/api: replace direct access to JSON number value by call to function cJSON_GetNumberValue() (issue #2066)
Diffstat (limited to 'src/plugins/relay')
-rw-r--r--src/plugins/relay/api/relay-api-protocol.c4
-rw-r--r--src/plugins/relay/api/remote/relay-remote-network.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/relay/api/relay-api-protocol.c b/src/plugins/relay/api/relay-api-protocol.c
index 46a47c180..031fc0144 100644
--- a/src/plugins/relay/api/relay-api-protocol.c
+++ b/src/plugins/relay/api/relay-api-protocol.c
@@ -516,7 +516,7 @@ RELAY_API_PROTOCOL_CALLBACK(input)
if (cJSON_IsNumber (json_buffer_id))
{
snprintf (str_id, sizeof (str_id),
- "%lld", (long long)json_buffer_id->valuedouble);
+ "%lld", (long long)cJSON_GetNumberValue (json_buffer_id));
ptr_buffer = weechat_buffer_search ("==id", str_id);
if (!ptr_buffer)
{
@@ -524,7 +524,7 @@ RELAY_API_PROTOCOL_CALLBACK(input)
client,
RELAY_HTTP_404_NOT_FOUND, NULL,
"Buffer \"%lld\" not found",
- (long long)json_buffer_id->valuedouble);
+ (long long)cJSON_GetNumberValue (json_buffer_id));
cJSON_Delete (json_body);
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/relay/api/remote/relay-remote-network.c b/src/plugins/relay/api/remote/relay-remote-network.c
index f5a11c1f1..f3e7165f3 100644
--- a/src/plugins/relay/api/remote/relay-remote-network.c
+++ b/src/plugins/relay/api/remote/relay-remote-network.c
@@ -905,7 +905,7 @@ relay_remote_network_url_handshake_cb (const void *pointer,
/* hash iterations */
json_hash_iterations = cJSON_GetObjectItem (json_body, "password_hash_iterations");
if (json_hash_iterations && cJSON_IsNumber (json_hash_iterations))
- remote->password_hash_iterations = json_hash_iterations->valueint;
+ remote->password_hash_iterations = (int)cJSON_GetNumberValue (json_hash_iterations);
/* TOTP */
json_totp = cJSON_GetObjectItem (json_body, "totp");
if (json_totp && cJSON_IsBool (json_totp))