pspp-dump-sav; Fix write past end of buffer in corner case.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 23 Feb 2019 01:16:40 +0000 (17:16 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 23 Feb 2019 01:16:40 +0000 (17:16 -0800)
commitbe42ce976006feed2a7ba7599ee417c28887af52
treef8bc6ff042953d6cc2ca5ea44b5fb87bac55660f
parent937311ef101f8109bb1baf3839aad6b42d871b75
pspp-dump-sav; Fix write past end of buffer in corner case.

If count == 0 and size > 0, then n_bytes is 0, buffer is a 1-byte
allocation, and the assignment to buffer[size] would write to buffer[1]
(or past it), which is past the end of the allocation.

Found by Address Sanitizer.
utilities/pspp-dump-sav.c