OSDN Git Service

When locale is enabled, sprintf("%.123s", str) is counting characters, not bytes...
authorRob Landley <rob@landley.net>
Mon, 9 Jun 2014 10:51:04 +0000 (05:51 -0500)
committerRob Landley <rob@landley.net>
Mon, 9 Jun 2014 10:51:04 +0000 (05:51 -0500)
commit89a62bf2907412cb562d22c875736357e314c8c8
tree0dbb98c25b73f9320c090c7aeceb98ea2fe23fa6
parentc421b7068c5dd95baa10f9bd97e578d04ba48c70
When locale is enabled, sprintf("%.123s", str) is counting characters, not bytes, so we can't globally enable locale without opening stack/heap smashing vulnerabilities. Make commands individually request setlocale() using TOYFLAGS instead.
toys.h
toys/posix/expand.c
toys/posix/wc.c