Skip to content

Commit

Permalink
fix: add check for .push("") in translate_path_at()
Browse files Browse the repository at this point in the history
  • Loading branch information
imlk0 authored and oxr463 committed Jul 27, 2021
1 parent 4199f48 commit 4660efd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/process/tracee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::rc::Rc;
use nix::sys::ptrace::{self, Options};
use nix::sys::signal::Signal;
use nix::unistd::Pid;
use nix::NixPath;

use crate::errors::*;
use crate::filesystem::Substitutor;
Expand Down Expand Up @@ -259,7 +260,10 @@ impl Tracee {
) -> Result<PathBuf> {
if guest_path.as_ref().is_relative() {
let mut dir_path = self.get_path_from_fd(dirfd, Side::Guest)?;
dir_path.push(guest_path);
// Check if guest_path is empty to avoid side effects of .push()
if !guest_path.as_ref().is_empty() {
dir_path.push(guest_path);
}
self.fs
.borrow()
.translate_absolute_path(dir_path, deref_final)
Expand Down

0 comments on commit 4660efd

Please sign in to comment.