From 4a24a6dd10a282be38994020906e38fbc166e7c7 Mon Sep 17 00:00:00 2001 From: Peter Hyman Date: Tue, 10 Mar 2015 11:30:37 -0700 Subject: [PATCH] Correct adding slash to control->tmpdir. off-by-one error. --- lrzip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lrzip.c b/lrzip.c index df65b37..1bf39a3 100644 --- a/lrzip.c +++ b/lrzip.c @@ -1280,9 +1280,9 @@ bool initialise_control(rzip_control *control) if (control->tmpdir == NULL) fatal_return(("Failed to allocate for tmpdir\n"), false); strcpy(control->tmpdir, eptr); - if (control->tmpdir[len] != '/') + if (control->tmpdir[len-1] != '/') { control->tmpdir[len] = '/'; /* need a trailing slash */ - control->tmpdir[len+1] = '\0'; - + control->tmpdir[len+1] = '\0'; + } return true; }