Instead of
```cpp
std::string value;
value = buff;
return value;
 ```
you could simply write (taking the above-mentioned change into account and assuming null-terminated strings):
```cpp
return std::string(&buff[0]);
 ```