Skip to content
Snippets Groups Projects
Verified Commit cd294d35 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

[Cache] Fix invalid pointer use for returned user home

parent b1973de7
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ use std::collections::HashMap;
use std::sync::{Mutex, MutexGuard};
use libc::{geteuid, seteuid, getpwnam, uid_t};
use std::ffi::CString;
use std::ffi::{CStr, CString};
use oauth2::basic::BasicTokenResponse;
......@@ -114,7 +114,7 @@ impl Cache {
};
let user_home;
unsafe {
user_home = CString::from_raw((*getpwnam(nam.as_ptr())).pw_dir);
user_home = CStr::from_ptr((*getpwnam(nam.as_ptr())).pw_dir);
};
env::set_var("HOME", user_home.to_str().unwrap());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment