aboutsummaryrefslogtreecommitdiff
path: root/NK_C_API.cc
diff options
context:
space:
mode:
Diffstat (limited to 'NK_C_API.cc')
-rw-r--r--NK_C_API.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc
index 538e7a9..556ec65 100644
--- a/NK_C_API.cc
+++ b/NK_C_API.cc
@@ -146,11 +146,17 @@ extern uint8_t* NK_read_config(){
}
+void clear_string(std::string &s){
+ std::fill(s.begin(), s.end(), ' ');
+}
+
extern const char * NK_status() {
auto m = NitrokeyManager::instance();
return get_with_string_result([&](){
- string s = m->get_status(); //FIXME string without clearing
- return strdup(s.c_str());
+ string && s = m->get_status();
+ char * rs = strdup(s.c_str());
+ clear_string(s);
+ return rs;
});
}