openbsd-ports/print/mpage/patches/patch-args_c
jasper 9ba3b19ab3 - update mpage to 2.5.6
- update maintainer address
- regen plist

from ian mcwilliam (MAINTAINER)
2010-05-26 13:53:16 +00:00

36 lines
1.7 KiB
Plaintext

$OpenBSD: patch-args_c,v 1.5 2010/05/26 13:53:16 jasper Exp $
--- args.c.orig Mon May 31 05:37:45 2004
+++ args.c Fri May 21 11:57:57 2010
@@ -36,6 +36,7 @@ do_args(int argc, char **argv, int envflag)
int finished;
int currarg;
int opterrors;
+ size_t len;
int i;
@@ -152,18 +153,17 @@ do_args(int argc, char **argv, int envflag)
break;
case 'C': /* select character definitions */
consumed = 1;
+ len = (strlen(libdir) + strlen(optstr) + 2);
if (*++optstr) { /* did we get a encoding name ? */
- if ((charvec_file = (char *) malloc(strlen(libdir) +
- strlen(optstr) +
- 2)) == NULL) {
+ if ((charvec_file = (char *) malloc(len)) == NULL) {
perror(optstr);
fprintf(stderr,
"ignoring character encoding definition\n");
}
else {
- (void) strcpy(charvec_file, libdir);
- (void) strcat(charvec_file, "/");
- (void) strcat(charvec_file, optstr);
+ (void) strlcpy(charvec_file, libdir, len);
+ (void) strlcat(charvec_file, "/", len);
+ (void) strlcat(charvec_file, optstr, len);
opt_encoding = 1;
}
}