mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 04:27:45 +00:00
usernames can only be up to 104 characters in windows, fix #565
This commit is contained in:
parent
f0e5c19ed4
commit
94cd6eb543
1 changed files with 2 additions and 2 deletions
|
@ -17,8 +17,8 @@ extern "system" {
|
|||
|
||||
#[allow(unused_unsafe)]
|
||||
pub unsafe fn getusername() -> String {
|
||||
// XXX: it may be possible that this isn't long enough. I don't know
|
||||
let mut buffer: [libc::c_char; 2048] = mem::uninitialized();
|
||||
// usernames can only be up to 104 characters in windows
|
||||
let mut buffer: [libc::c_char; 105] = mem::uninitialized();
|
||||
|
||||
if !GetUserNameA(buffer.as_mut_ptr(), &mut (buffer.len() as libc::uint32_t)) == 0 {
|
||||
crash!(1, "username is too long");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue