]> diplodocus.org Git - nmh/commitdiff
fmt_scan(): Avoid undefined behaviour from overlapping strncpy(3).
authorRalph Corderoy <ralph@inputplus.co.uk>
Tue, 23 Jan 2018 16:37:01 +0000 (16:37 +0000)
committerRalph Corderoy <ralph@inputplus.co.uk>
Tue, 23 Jan 2018 18:05:33 +0000 (18:05 +0000)
M. Levinson pointed out in private email that pcc(1) tickles a bug that
causes undefined behaviour due to part of `buffer[]', accessed by `str',
being strncpy(3) back to its start.  Fix by using memmove(3) to slide
`str' back to `buffer's beginning whenever it may have wandered off.

Fixes e8635a8a that added `%(unquote)', but using `%(trim)' twice was
also faulty in the same way and pre-dates git.


No differences found