diff --git a/misc.c b/misc.c index bc7804fc3..d8856094b 100644 --- a/misc.c +++ b/misc.c @@ -1149,7 +1149,7 @@ duplicateargs(arglist *dest, arglist *source) if (source->list != NULL) { for (int i = 0; i < source->num; i++) { - addargs(dest, source->list[i]); + addargs(dest, "%s", source->list[i]); } } } diff --git a/regress/scp.sh b/regress/scp.sh index 63bfa88d5..e491512b4 100644 --- a/regress/scp.sh +++ b/regress/scp.sh @@ -105,6 +105,16 @@ for mode in scp sftp ; do $SCP "${scpopts[@]}" *metachar* ${DIR2} 2>&1 2>/dev/null; \ [ ! -f metachartest ] ) || fail "shell metacharacters" + if test $mode = scp ; then + verbose "$tag: input args & printf check" + scpclean + cp ${DATA} ${COPY} + $SCP "${scpopts[@]}" -vvv -o '"%h %p"' ${COPY} somehost:${DIR} 2>&1 | tee scp_printf_test.txt + # relies on debug log statement, specifically from "debug3: spawning..." + [[ " $( cat "scp_printf_test.txt" ) " =~ "%h %p" ]] || fail "input args & printf check failed" + rm -f scp_printf_test.txt + fi + if [ ! -z "$SUDO" ]; then verbose "$tag: skipped file after scp -p with failed chown+utimes" scpclean