truncating string copy
The majority of our calls to strncpy are in the form (void) strncpy(dst, src, n); dst[n] = '\0'; so add a new routine, copynchars, which does that. A few calls care about strncpy's return value and at least one relies on it only copying a substring without also terminating the output, but most don't care about either and none seem to care that `n' ought to have type size_t instead of int. The new routine matches our usage better, but I haven't gone through to change the existing strncpy calls.
This commit is contained in:
@@ -807,6 +807,7 @@ E char *FDECL(upstart, (char *));
|
||||
E char *FDECL(mungspaces, (char *));
|
||||
E char *FDECL(eos, (char *));
|
||||
E char *FDECL(strkitten, (char *,CHAR_P));
|
||||
E void FDECL(copynchars, (char *,const char *,int));
|
||||
E char *FDECL(s_suffix, (const char *));
|
||||
E char *FDECL(xcrypt, (const char *,char *));
|
||||
E boolean FDECL(onlyspace, (const char *));
|
||||
|
||||
Reference in New Issue
Block a user