From: Ken Raeburn Date: Tue, 26 Jun 2007 23:04:09 +0000 (+0000) Subject: * v4rcp.c (error): Use stdarg version always. Call vsnprintf instead of vsprintf. X-Git-Tag: krb5-1.7-alpha1~1049 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=98ae6e07fe8d5c32b98e06c1a852a32c839d80e2;p=krb5.git * v4rcp.c (error): Use stdarg version always. Call vsnprintf instead of vsprintf. (strsave): Call strdup. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19642 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/bsd/v4rcp.c b/src/appl/bsd/v4rcp.c index 788c1f586..71b1b8da4 100644 --- a/src/appl/bsd/v4rcp.c +++ b/src/appl/bsd/v4rcp.c @@ -948,27 +948,16 @@ allocbuf(bp, fd, blksize) } void -#ifdef HAVE_STDARG_H error(char *fmt, ...) -#else -/*VARARGS1*/ -error(fmt, va_alist) - char *fmt; - va_dcl -#endif { va_list ap; char buf[BUFSIZ], *cp = buf; -#ifdef HAVE_STDARG_H va_start(ap, fmt); -#else - va_start(ap); -#endif errs++; *cp++ = 1; - (void) vsprintf(cp, fmt, ap); + (void) vsnprintf(cp, sizeof(buf) - (cp-buf), fmt, ap); va_end(ap); if (krem) @@ -1008,13 +997,13 @@ strsave(sp) char *sp; { register char *ret; - - if((ret = (char *)malloc((unsigned) strlen(sp)+1)) == NULL) { + + ret = strdup(sp); + if (ret == NULL) { fprintf(stderr, "rcp: no memory for saving args\n"); exit(1); } - (void) strcpy(ret,sp); - return(ret); + return ret; } #endif