=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/indent/indent.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- src/usr.bin/indent/indent.c 2002/11/29 20:15:43 1.13 +++ src/usr.bin/indent/indent.c 2003/04/25 23:33:56 1.14 @@ -1,4 +1,4 @@ -/* $OpenBSD: indent.c,v 1.13 2002/11/29 20:15:43 deraadt Exp $ */ +/* $OpenBSD: indent.c,v 1.14 2003/04/25 23:33:56 krw Exp $ */ /* * Copyright (c) 1980, 1993 @@ -47,7 +47,7 @@ #ifndef lint /*static char sccsid[] = "@(#)indent.c 5.17 (Berkeley) 6/7/93";*/ -static char rcsid[] = "$OpenBSD: indent.c,v 1.13 2002/11/29 20:15:43 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: indent.c,v 1.14 2003/04/25 23:33:56 krw Exp $"; #endif /* not lint */ #include @@ -507,8 +507,10 @@ if (ps.in_decl && !ps.block_init) if (troff && !ps.dumped_decl_indent && !is_procname && ps.last_token == decl) { ps.dumped_decl_indent = 1; - sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token); + snprintf(e_code, (l_code - e_code) + 5, + "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token); e_code += strlen(e_code); + CHECK_SIZE_CODE; } else { while ((e_code - s_code) < dec_ind) { @@ -577,9 +579,11 @@ *e_code++ = ' '; if (troff && !ps.dumped_decl_indent && ps.in_decl && !is_procname) { - sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token); + snprintf(e_code, (l_code - e_code) + 5, + "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token); ps.dumped_decl_indent = 1; e_code += strlen(e_code); + CHECK_SIZE_CODE; } else { char *res = token; @@ -918,9 +922,11 @@ if (is_procname == 0 || !procnames_start_line) { if (!ps.block_init) { if (troff && !ps.dumped_decl_indent) { - sprintf(e_code, "\n.De %dp+\200p\n", dec_ind * 7); + snprintf(e_code, (l_code - e_code) + 5, + "\n.De %dp+\200p\n", dec_ind * 7); ps.dumped_decl_indent = 1; e_code += strlen(e_code); + CHECK_SIZE_CODE; } else while ((e_code - s_code) < dec_ind) {