Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v.in.dwg: avoid src and dst overlap in sprintf
Currently, one instance of sprintf has same src and dst pointers, probably to append new information to the buffer. But, having overlapping src and dst pointers is undefined behavior. In the new set of changes, code is refactored to automatically start writing new data at the end of previous data. snprintf is also used over sprintf to be wary of the fact that buffer size is limited to 2000. Since, snprintf automatically adds a null character to the end, to find the remaining buffer space, we subtract existing buffer length as well as null character to find maximum possible space to write in the buffer. This translates to '2000 - buflen - 1'. Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
- Loading branch information