Skip to content

Commit 5ab2964

Browse files
committed
Fixed data corruption for long field values. (Fix #52)
1 parent fd7f016 commit 5ab2964

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

THANKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ Luciano Souza (Project quality)
1010
Troy D. Hanson [troydhanson] (uthash)
1111
Valmadson Santos (Project user/tester)
1212
Waldir Paim [waldirpaim] (Project mentor)
13+
stensalweb (Project developer)
1314

1415
and special thanks to the people who help me to maintain this project!

include/sagui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ extern "C" {
7474

7575
#define SG_VERSION_MAJOR 3
7676
#define SG_VERSION_MINOR 3
77-
#define SG_VERSION_PATCH 3
77+
#define SG_VERSION_PATCH 4
7878
#define SG_VERSION_HEX \
7979
((SG_VERSION_MAJOR << 16) | (SG_VERSION_MINOR << 8) | (SG_VERSION_PATCH))
8080

src/sg_httpuplds.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Cross-platform library which helps to develop web servers or frameworks.
99
*
10-
* Copyright (C) 2016-2020 Silvio Clecio <[email protected]>
10+
* Copyright (C) 2016-2021 Silvio Clecio <[email protected]>
1111
*
1212
* Sagui library is free software; you can redistribute it and/or
1313
* modify it under the terms of the GNU Lesser General Public
@@ -113,11 +113,11 @@ static enum MHD_Result
113113
return MHD_NO;
114114
HASH_ADD_STR(holder->req->fields, key, holder->req->curr_field);
115115
} else {
116-
val = sg_realloc(holder->req->curr_field->val, off + size);
116+
val = sg_realloc(holder->req->curr_field->val, off + size + 1);
117117
if (!val)
118118
return MHD_NO;
119119
holder->req->curr_field->val = val;
120-
memcpy(holder->req->curr_field->val + off, data, size);
120+
memcpy(holder->req->curr_field->val + off, data, size + 1);
121121
}
122122
if (holder->srv->payld_limit > 0) {
123123
holder->req->total_fields_size += size;

0 commit comments

Comments
 (0)