Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
fix: response truncated at the last character
Browse files Browse the repository at this point in the history
  • Loading branch information
zengxs committed Dec 21, 2018
1 parent 731bebe commit 5f74ab3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion EasyHautX/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
4 changes: 2 additions & 2 deletions EasyHautX/httpclient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ size_t srun3k_login(const char *url, payload_t *payload, const char *key, char *
return 0;
} else {
std::cout << readBuffer << std::endl;
size_t ret_size = sizeof(char) * readBuffer.length();
size_t ret_size = sizeof(char) * (readBuffer.length() + 1);
*response = (char *)malloc(ret_size);
snprintf(*response, ret_size, "%s", readBuffer.c_str());
return ret_size;
Expand Down Expand Up @@ -127,7 +127,7 @@ size_t srun3k_logout(const char *url, Payload payload, char **response) {

if (res == CURLE_OK) {
std::cout << readBuffer << std::endl;
size_t ret_size = sizeof(char) * readBuffer.length();
size_t ret_size = sizeof(char) * (readBuffer.length() + 1);
*response = (char *)malloc(ret_size);
snprintf(*response, ret_size, "%s", readBuffer.c_str());
return ret_size;
Expand Down

0 comments on commit 5f74ab3

Please sign in to comment.