--- atftp-0.7.dfsg.orig/tftp_def.c +++ atftp-0.7.dfsg/tftp_def.c @@ -140,8 +140,10 @@ */ inline char *Strncpy(char *to, const char *from, size_t size) { - to[size-1] = '\000'; - return strncpy(to, from, size - 1); + strncpy(to, from, size); + if (size>0) + to[size-1] = '\000'; + return to; }