Browse Source

Merge pull request #70 from risoflora/unhandled-error-due-to-invalid-post-request

Unhandled error due to invalid POST request
Silvio Clécio 9 months ago
parent
commit
451d7240ac
2 changed files with 5 additions and 3 deletions
  1. 2 2
      include/sagui.h
  2. 3 1
      src/sg_httpuplds.c

+ 2 - 2
include/sagui.h

@@ -7,7 +7,7 @@
  *
  *
  * Cross-platform library which helps to develop web servers or frameworks.
  * Cross-platform library which helps to develop web servers or frameworks.
  *
  *
- * Copyright (C) 2016-2024 Silvio Clecio <[email protected]>
+ * Copyright (C) 2016-2025 Silvio Clecio <[email protected]>
  *
  *
  * Sagui library is free software; you can redistribute it and/or
  * Sagui library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * modify it under the terms of the GNU Lesser General Public
@@ -74,7 +74,7 @@ extern "C" {
 
 
 #define SG_VERSION_MAJOR 3
 #define SG_VERSION_MAJOR 3
 #define SG_VERSION_MINOR 5
 #define SG_VERSION_MINOR 5
-#define SG_VERSION_PATCH 1
+#define SG_VERSION_PATCH 2
 #define SG_VERSION_HEX                                                         \
 #define SG_VERSION_HEX                                                         \
   ((SG_VERSION_MAJOR << 16) | (SG_VERSION_MINOR << 8) | (SG_VERSION_PATCH))
   ((SG_VERSION_MAJOR << 16) | (SG_VERSION_MINOR << 8) | (SG_VERSION_PATCH))
 
 

+ 3 - 1
src/sg_httpuplds.c

@@ -7,7 +7,7 @@
  *
  *
  * Cross-platform library which helps to develop web servers or frameworks.
  * Cross-platform library which helps to develop web servers or frameworks.
  *
  *
- * Copyright (C) 2016-2021 Silvio Clecio <[email protected]>
+ * Copyright (C) 2016-2025 Silvio Clecio <[email protected]>
  *
  *
  * Sagui library is free software; you can redistribute it and/or
  * Sagui library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * modify it under the terms of the GNU Lesser General Public
@@ -108,6 +108,8 @@ static enum MHD_Result
       }
       }
     } else {
     } else {
       if (off == 0) {
       if (off == 0) {
+        if (!key || !data)
+          return MHD_NO;
         holder->req->curr_field = sg__strmap_new(key, data);
         holder->req->curr_field = sg__strmap_new(key, data);
         if (!holder->req->curr_field)
         if (!holder->req->curr_field)
           return MHD_NO;
           return MHD_NO;