3 ms·
Doesn't memcpy have the same issue as strncpy? the destination will not be null terminated if the source is too long. Many projects just implement a safe_strnc
by icedchai 5y ago
Doesn't memcpy have the same issue as strncpy? the destination will not be null terminated if the source is too long.
Many projects just implement a safe_strncpy wrapper that always terminates the destination. Example: https://github.com/brgl/busybox/blob/master/libbb/safe_strncpy.c https://github.com/brgl/busybox/blob/master/libbb/safe_strnc...