[Bug 3002] New: Incorrect left alignment in progressmeter.c
bugzilla-daemon at bugzilla.mindrot.org
bugzilla-daemon at bugzilla.mindrot.org
Fri May 3 00:46:32 AEST 2019
https://bugzilla.mindrot.org/show_bug.cgi?id=3002
Bug ID: 3002
Summary: Incorrect left alignment in progressmeter.c
Product: Portable OpenSSH
Version: 8.0p1
Hardware: Other
OS: Other
Status: NEW
Severity: major
Priority: P5
Component: scp
Assignee: unassigned-bugs at mindrot.org
Reporter: velemas at gmail.com
On my system (BS2000/390) new progress meter works incorrectly. It
outputs grabage beyond buffer boundaries:
...
scp 50% 7808KB 913.9KB/s 00:08 ETA▒▒0▒▒
scp 55% 8631KB 906.3KB/s 00:07 ETA▒▒0▒▒
scp 56% 8731KB 825.7KB/s 00:08 ETA▒▒0▒▒
scp 58% 9131KB 783.4KB/s 00:08 ETA▒▒0▒▒
scp 71% 11MB 908.0KB/s 00:04 ETA▒▒0▒▒
scp 74% 11MB 860.9KB/s 00:04 ETA▒▒0▒▒
scp 75% 11MB 785.0KB/s 00:04 ETA▒▒0▒▒
scp 84% 13MB 858.7KB/s 00:02 ETA▒▒0▒▒
scp 87% 13MB 822.6KB/s 00:02 ETA▒▒0▒▒
scp 88% 13MB 751.8KB/s 00:02 ETA▒▒0▒▒
scp 89% 14MB 687.8KB/s 00:02 ETA▒▒0▒▒
scp 95% 14MB 708.2KB/s 00:01 ETA▒▒0▒▒
...
Quick investigation showed that culprit is <file_len * -1> in
progressmeter.c:
snmprintf(buf+1, sizeof(buf)-1 , &file_len, "%*s",
file_len * -1, file);
If I change it to:
snmprintf(buf+1, sizeof(buf)-1 , &file_len, "%-*s",
file_len, file);
it fixes the issue.
"%-*s" is a correct left alignment in printf-like functions.
--
You are receiving this mail because:
You are watching the assignee of the bug.
More information about the openssh-bugs
mailing list