sysinfo;win32: don't print the username null terminator

This commit is contained in:
Danny Robson 2019-06-28 15:14:34 +10:00
parent 5c14eb01e1
commit d40d454ca4

View File

@ -63,7 +63,8 @@ cruft::util::operator<< (std::ostream &os, sysinfo const &)
if (0 == GetUserNameA (&name[0], &size)) if (0 == GetUserNameA (&name[0], &size))
win32::error::throw_code (); win32::error::throw_code ();
name.resize (size); // Remove the provided trailing null terminator
name.resize (size - 1);
os << ", username: " << name; os << ", username: " << name;
} }