X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=sidebyside;f=libbb%2Fsafe_strncpy.c;h=2016e6b52571a61d2cd7134b4bff8500f432b553;hb=164c5c80ba122a6ed71a29d41730c802750a5ae1;hp=08a2a0d9ccce78b27cfa111e829f06f3a7f4d143;hpb=cb81e6484d1f50ec2761f6294722407b14add525;p=oweals%2Fbusybox.git diff --git a/libbb/safe_strncpy.c b/libbb/safe_strncpy.c index 08a2a0d9c..2016e6b52 100644 --- a/libbb/safe_strncpy.c +++ b/libbb/safe_strncpy.c @@ -2,7 +2,7 @@ /* * Utility routines. * - * Copyright (C) 1999-2003 by Erik Andersen + * Copyright (C) 1999-2004 by Erik Andersen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,11 +24,11 @@ -/* Like strncpy but make sure the resulting string is always 0 terminated. */ +/* Like strncpy but make sure the resulting string is always 0 terminated. */ extern char * safe_strncpy(char *dst, const char *src, size_t size) -{ +{ dst[size-1] = '\0'; - return strncpy(dst, src, size-1); + return strncpy(dst, src, size-1); }