o Simple strcpy/strcat replacement.

PR:		bin/101575
Founded by:	Dan Lukes
Obtained from:	OpenBSD, rev. 1.11 by deraadt
MFC after:	2 weeks
This commit is contained in:
Maxim Konovalov 2006-08-09 19:12:10 +00:00
parent 5011eea82f
commit e4df92e126

View File

@ -213,6 +213,7 @@ rewrite(FS *fs)
unsigned char *p1, *p2, *fmtp;
char savech, cs[3];
int nconv, prec;
size_t len;
nextpr = NULL;
prec = 0;
@ -394,10 +395,10 @@ isint2: switch(fu->bcnt) {
*/
savech = *p2;
p1[0] = '\0';
if ((pr->fmt = calloc(1, strlen(fmtp) + 2)) == NULL)
len = strlen(fmtp) + strlen(cs) + 1;
if ((pr->fmt = calloc(1, len)) == NULL)
err(1, NULL);
(void)strcpy(pr->fmt, fmtp);
(void)strcat(pr->fmt, cs);
snprintf(pr->fmt, len, "%s%s", fmtp, cs);
*p2 = savech;
pr->cchar = pr->fmt + (p1 - fmtp);
fmtp = p2;