From: mike Date: Thu, 31 Jan 2013 13:08:59 +0000 (+0000) Subject: Switch from strncpy to memcpy in a few places. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edf681daeb114e498604a3d1b43166377118fb3c;p=thirdparty%2Fcups.git Switch from strncpy to memcpy in a few places. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10845 7a7537e8-13f0-0310-91df-b6672ffda945 --- diff --git a/cups/snprintf.c b/cups/snprintf.c index 2c45fa8df1..9af6b90f85 100644 --- a/cups/snprintf.c +++ b/cups/snprintf.c @@ -3,7 +3,7 @@ * * snprintf functions for CUPS. * - * Copyright 2007-2012 by Apple Inc. + * Copyright 2007-2013 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -296,13 +296,13 @@ _cups_vsnprintf(char *buffer, /* O - Output buffer */ if (sign == '-') { - strncpy(bufptr, s, (size_t)slen); + memcpy(bufptr, s, (size_t)slen); memset(bufptr + slen, ' ', (size_t)(width - slen)); } else { memset(bufptr, ' ', (size_t)(width - slen)); - strncpy(bufptr + width - slen, s, (size_t)slen); + memcpy(bufptr + width - slen, s, (size_t)slen); } bufptr += width; diff --git a/ppdc/ppdc-source.cxx b/ppdc/ppdc-source.cxx index 9560daa49b..222ccfd25f 100644 --- a/ppdc/ppdc-source.cxx +++ b/ppdc/ppdc-source.cxx @@ -3,7 +3,7 @@ // // Source class for the CUPS PPD Compiler. // -// Copyright 2007-2012 by Apple Inc. +// Copyright 2007-2013 by Apple Inc. // Copyright 2002-2007 by Easy Software Products. // // These coded instructions, statements, and computer programs are the @@ -2292,7 +2292,7 @@ ppdcSource::quotef(cups_file_t *fp, // I - File to write to if ((format - bufformat + 1) > (int)sizeof(tformat)) break; - strncpy(tformat, bufformat, format - bufformat); + memcpy(tformat, bufformat, format - bufformat); tformat[format - bufformat] = '\0'; bytes += cupsFilePrintf(fp, tformat, va_arg(ap, double)); @@ -2309,7 +2309,7 @@ ppdcSource::quotef(cups_file_t *fp, // I - File to write to if ((format - bufformat + 1) > (int)sizeof(tformat)) break; - strncpy(tformat, bufformat, format - bufformat); + memcpy(tformat, bufformat, format - bufformat); tformat[format - bufformat] = '\0'; # ifdef HAVE_LONG_LONG @@ -2327,7 +2327,7 @@ ppdcSource::quotef(cups_file_t *fp, // I - File to write to if ((format - bufformat + 1) > (int)sizeof(tformat)) break; - strncpy(tformat, bufformat, format - bufformat); + memcpy(tformat, bufformat, format - bufformat); tformat[format - bufformat] = '\0'; bytes += cupsFilePrintf(fp, tformat, va_arg(ap, void *));