Skip to content

Commit b4694d8

Browse files
committed
fixing null termination of the temporary buffer
1 parent 3ed24d2 commit b4694d8

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/influxdb-cpp-rest/influxdb_line.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ namespace influxdb {
8888
}
8989

9090
inline std::string get() const {
91-
return res.data();
91+
return std::string(res.data(),res.size());
9292
}
9393

9494
inline bool empty() const {
@@ -174,7 +174,7 @@ namespace influxdb {
174174
}
175175
public:
176176
inline std::string get() const {
177-
return res.data();
177+
return std::string(res.data(),res.size());
178178
}
179179
};
180180

src/influxdb-cpp-rest/influxdb_simple_async_api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct influxdb::async_api::simple_db::impl {
6868
.subscribe([this](std::shared_ptr<fmt::memory_buffer> const& w) {
6969
if (w->size() > 0u) {
7070
try {
71-
db.insert_async(w->data());
71+
db.insert_async(std::string(w->data(),w->size()));
7272
} catch (const std::runtime_error& e) {
7373
throw std::runtime_error(std::string("async_api::insert failed: ") + e.what() + " -> Dropping " + std::to_string(w->size()) + " bytes");
7474
}

src/script/test.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
set -euo pipefail
33
IFS=$'\n\t'
44

5+
# first parameter to the test script (directory with the test binaries) is mandatory
6+
echo "running tests from $1"
7+
pkill influxd || true
58
./influxdb-1.7.6-1/usr/bin/influxd &
6-
sleep 1
9+
sleep 3
710
$1/test-influxdb-cpp-rest -d yes
811
export LD_LIBRARY_PATH=$1
912
$1/test-influxdb-c-rest -d yes

0 commit comments

Comments
 (0)