=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/pr/pr.c,v retrieving revision 1.23 retrieving revision 1.24 diff -c -r1.23 -r1.24 *** src/usr.bin/pr/pr.c 2007/03/03 23:16:02 1.23 --- src/usr.bin/pr/pr.c 2007/09/03 05:40:00 1.24 *************** *** 1,4 **** ! /* $OpenBSD: pr.c,v 1.23 2007/03/03 23:16:02 jmc Exp $ */ /*- * Copyright (c) 1991 Keith Muller. --- 1,4 ---- ! /* $OpenBSD: pr.c,v 1.24 2007/09/03 05:40:00 deraadt Exp $ */ /*- * Copyright (c) 1991 Keith Muller. *************** *** 41,47 **** #ifndef lint /* from: static char sccsid[] = "@(#)pr.c 8.1 (Berkeley) 6/6/93"; */ ! static char *rcsid = "$OpenBSD: pr.c,v 1.23 2007/03/03 23:16:02 jmc Exp $"; #endif /* not lint */ #include --- 41,47 ---- #ifndef lint /* from: static char sccsid[] = "@(#)pr.c 8.1 (Berkeley) 6/6/93"; */ ! static char *rcsid = "$OpenBSD: pr.c,v 1.24 2007/09/03 05:40:00 deraadt Exp $"; #endif /* not lint */ #include *************** *** 210,216 **** /* * allocate line buffer */ ! if ((obuf = malloc((unsigned)(LBUF + off)*sizeof(char))) == NULL) { mfail(); return(1); } --- 210,216 ---- /* * allocate line buffer */ ! if ((obuf = malloc((unsigned)LBUF + off)) == NULL) { mfail(); return(1); } *************** *** 218,224 **** /* * allocate header buffer */ ! if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) { mfail(); return(1); } --- 218,224 ---- /* * allocate header buffer */ ! if ((hbuf = malloc((unsigned)HDBUF + offst)) == NULL) { mfail(); return(1); } *************** *** 376,382 **** /* * allocate page buffer */ ! if ((buf = malloc((unsigned)lines*mxlen*sizeof(char))) == NULL) { mfail(); return(1); } --- 376,382 ---- /* * allocate page buffer */ ! if ((buf = malloc(unsigned)lines*mxlen)) == NULL) { mfail(); return(1); } *************** *** 384,390 **** /* * allocate page header */ ! if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) { mfail(); return(1); } --- 384,390 ---- /* * allocate page header */ ! if ((hbuf = malloc((unsigned)HDBUF + offst)) == NULL) { mfail(); return(1); } *************** *** 397,403 **** * col pointers when no headers */ mvc = lines * clcnt; ! if ((vc=(struct vcol *)malloc((unsigned)mvc*sizeof(struct vcol))) == NULL) { mfail(); return(1); } --- 397,403 ---- * col pointers when no headers */ mvc = lines * clcnt; ! if ((vc=(struct vcol *)calloc((unsigned)mvc, sizeof(struct vcol))) == NULL) { mfail(); return(1); } *************** *** 405,411 **** /* * pointer into page where last data per line is located */ ! if ((lstdat = (char **)malloc((unsigned)lines*sizeof(char *))) == NULL){ mfail(); return(1); } --- 405,411 ---- /* * pointer into page where last data per line is located */ ! if ((lstdat = (char **)calloc((unsigned)lines, sizeof(char *))) == NULL){ mfail(); return(1); } *************** *** 413,423 **** /* * fast index lookups to locate start of lines */ ! if ((indy = (int *)malloc((unsigned)lines*sizeof(int))) == NULL) { mfail(); return(1); } ! if ((lindy = (int *)malloc((unsigned)lines*sizeof(int))) == NULL) { mfail(); return(1); } --- 413,423 ---- /* * fast index lookups to locate start of lines */ ! if ((indy = (int *)calloc((unsigned)lines, sizeof(int))) == NULL) { mfail(); return(1); } ! if ((lindy = (int *)calloc((unsigned)lines, sizeof(int))) == NULL) { mfail(); return(1); } *************** *** 688,694 **** int ips = 0; int ops = 0; ! if ((buf = malloc((unsigned)(pgwd+offst+1)*sizeof(char))) == NULL) { mfail(); return(1); } --- 688,694 ---- int ips = 0; int ops = 0; ! if ((buf = malloc((unsigned)pgwd + offst + 1)) == NULL) { mfail(); return(1); } *************** *** 696,702 **** /* * page header */ ! if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) { mfail(); return(1); } --- 696,702 ---- /* * page header */ ! if ((hbuf = malloc((unsigned)HDBUF + offst)) == NULL) { mfail(); return(1); } *************** *** 896,902 **** /* * array of FILE *, one for each operand */ ! if ((fbuf = (FILE **)malloc((unsigned)clcnt*sizeof(FILE *))) == NULL) { mfail(); return(1); } --- 896,902 ---- /* * array of FILE *, one for each operand */ ! if ((fbuf = (FILE **)calloc((unsigned)clcnt, sizeof(FILE *))) == NULL) { mfail(); return(1); } *************** *** 904,910 **** /* * array of int *, one for each operand */ ! if ((rc = (int *)malloc((unsigned)clcnt*sizeof(int))) == NULL) { mfail(); return(1); } --- 904,910 ---- /* * array of int *, one for each operand */ ! if ((rc = (int *)calloc((unsigned)clcnt, sizeof(int))) == NULL) { mfail(); return(1); } *************** *** 912,918 **** /* * page header */ ! if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) { mfail(); return(1); } --- 912,918 ---- /* * page header */ ! if ((hbuf = malloc((unsigned)HDBUF + offst)) == NULL) { mfail(); return(1); } *************** *** 965,971 **** /* * line buffer */ ! if ((buf = malloc((unsigned)(pgwd+offst+1)*sizeof(char))) == NULL) { mfail(); return(1); } --- 965,971 ---- /* * line buffer */ ! if ((buf = malloc((unsigned)pgwd + offst + 1)) == NULL) { mfail(); return(1); }