[libgrss] src: Fix binding between mode and parameters in publisher
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgrss] src: Fix binding between mode and parameters in publisher
- Date: Thu, 16 Feb 2017 20:21:06 +0000 (UTC)
commit 79842ad8f207238346e3af985cf2e93c6319bf10
Author: Philip Withnall <withnall endlessm com>
Date: Wed Dec 21 16:51:33 2016 +0000
src: Fix binding between mode and parameters in publisher
Previously, the code assumed that the correct parameters were provided
for each mode, but that’s not necessarily the case. If incorrect
parameters were provided (specifically, if the ones pertaining to the
given mode were missing), some NULL pointer dereferences would happen
and hence the code would crash.
Fix that by checking for the parameters and returning error 400 if they
are not present.
Coverity IDs: 1388546, 1388547
https://bugzilla.gnome.org/show_bug.cgi?id=776115
src/feeds-publisher.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/feeds-publisher.c b/src/feeds-publisher.c
index 772d73b..2c919c6 100644
--- a/src/feeds-publisher.c
+++ b/src/feeds-publisher.c
@@ -840,12 +840,17 @@ handle_incoming_requests_cb (SoupServer *server, SoupMessage *msg, const char *p
}
}
else if (strcmp (mode, "unsubscribe") == 0) {
- client = search_subscriber_by_topic_and_callback (pub, topic, callback);
- if (client != NULL)
- client->status = REMOTE_UNSUBSCRIBING;
+ if (callback == NULL) {
+ soup_message_set_status (msg, 400);
+ }
+ else {
+ client = search_subscriber_by_topic_and_callback (pub, topic, callback);
+ if (client != NULL)
+ client->status = REMOTE_UNSUBSCRIBING;
+ }
}
- if (client != NULL) {
+ if (client != NULL && verify != NULL) {
verify_msg = verification_message_for_client (client);
if (strcmp (verify, "sync") == 0) {
@@ -859,6 +864,9 @@ handle_incoming_requests_cb (SoupServer *server, SoupMessage *msg, const char *p
soup_message_set_status (msg, 202);
}
}
+ else if (client != NULL) {
+ soup_message_set_status (msg, 400);
+ }
}
g_strfreev (contents);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]