]> granicus.if.org Git - nethack/commit
truncating string copy
authornethack.rankin <nethack.rankin>
Tue, 6 Mar 2007 03:00:05 +0000 (03:00 +0000)
committernethack.rankin <nethack.rankin>
Tue, 6 Mar 2007 03:00:05 +0000 (03:00 +0000)
commit5a874440a07b3a59bfec58042261e5f1b0278a42
tree0e7a5b869c754f3e5c40fb1f6f004ebf1162c3d3
parent2adc83e1451288e299039b964f95da7a66311dca
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.
include/extern.h
src/hacklib.c
src/questpgr.c