=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/rcs.c,v retrieving revision 1.185 retrieving revision 1.186 diff -c -r1.185 -r1.186 *** src/usr.bin/cvs/rcs.c 2006/07/08 09:25:44 1.185 --- src/usr.bin/cvs/rcs.c 2006/07/30 03:47:48 1.186 *************** *** 1,4 **** ! /* $OpenBSD: rcs.c,v 1.185 2006/07/08 09:25:44 ray Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: rcs.c,v 1.186 2006/07/30 03:47:48 ray Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 2660,2673 **** expbuf[0] = '\0'; if (mode & RCS_KWEXP_NAME) { ! if (strlcat(expbuf, "$", sizeof(expbuf)) ! >= sizeof(expbuf) || ! strlcat(expbuf, kwstr, sizeof(expbuf)) ! >= sizeof(expbuf)) fatal("rcs_expand_keywords: truncated"); if ((mode & RCS_KWEXP_VAL) && ! strlcat(expbuf, ": ", sizeof(expbuf)) ! >= sizeof(expbuf)) fatal("rcs_expand_keywords: truncated"); } --- 2660,2670 ---- expbuf[0] = '\0'; if (mode & RCS_KWEXP_NAME) { ! if (strlcat(expbuf, "$", sizeof(expbuf)) >= sizeof(expbuf) || ! strlcat(expbuf, kwstr, sizeof(expbuf)) >= sizeof(expbuf)) fatal("rcs_expand_keywords: truncated"); if ((mode & RCS_KWEXP_VAL) && ! strlcat(expbuf, ": ", sizeof(expbuf)) >= sizeof(expbuf)) fatal("rcs_expand_keywords: truncated"); } *************** *** 2678,2756 **** if (mode & RCS_KWEXP_VAL) { if (kwtype & RCS_KW_RCSFILE) { if (!(kwtype & RCS_KW_FULLPATH)) ! (void)strlcat(expbuf, ! basename(rcsfile), ! sizeof(expbuf)); else ! (void)strlcat(expbuf, ! rcsfile, sizeof(expbuf)); ! if (strlcat(expbuf, " ", ! sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: " ! "truncated"); } if (kwtype & RCS_KW_REVISION) { ! rcsnum_tostr(rdp->rd_num, buf, ! sizeof(buf)); ! if (strlcat(buf, " ", sizeof(buf)) ! >= sizeof(buf) || ! strlcat(expbuf, buf, ! sizeof(expbuf)) >= sizeof(buf)) ! fatal("rcs_expand_keywords: " ! "truncated"); } if (kwtype & RCS_KW_DATE) { fmt = "%Y/%m/%d %H:%M:%S "; ! strftime(buf, sizeof(buf), fmt, ! &rdp->rd_date); ! if (strlcat(expbuf, buf, ! sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: " ! "string truncated"); } if (kwtype & RCS_KW_AUTHOR) { ! if (strlcat(expbuf, rdp->rd_author, ! sizeof(expbuf)) >= sizeof(expbuf) || ! strlcat(expbuf, " ", ! sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: " ! "string truncated"); } if (kwtype & RCS_KW_STATE) { ! if (strlcat(expbuf, rdp->rd_state, ! sizeof(expbuf)) >= sizeof(expbuf) || ! strlcat(expbuf, " ", ! sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: " ! "string truncated"); } /* order does not matter anymore below */ if (kwtype & RCS_KW_LOG) ! if (strlcat(expbuf, " ", ! sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: " ! "string truncated"); if (kwtype & RCS_KW_SOURCE) { ! if (strlcat(expbuf, rcsfile, ! sizeof(expbuf)) >= sizeof(expbuf) || ! strlcat(expbuf, " ", ! sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: " ! "string truncated"); } if (kwtype & RCS_KW_NAME) ! if (strlcat(expbuf, " ", ! sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: " ! "string truncated"); } /* end the expansion */ --- 2675,2728 ---- if (mode & RCS_KWEXP_VAL) { if (kwtype & RCS_KW_RCSFILE) { if (!(kwtype & RCS_KW_FULLPATH)) ! (void)strlcat(expbuf, basename(rcsfile), sizeof(expbuf)); else ! (void)strlcat(expbuf, rcsfile, sizeof(expbuf)); ! if (strlcat(expbuf, " ", sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: truncated"); } if (kwtype & RCS_KW_REVISION) { ! rcsnum_tostr(rdp->rd_num, buf, sizeof(buf)); ! if (strlcat(buf, " ", sizeof(buf)) >= sizeof(buf) || ! strlcat(expbuf, buf, sizeof(expbuf)) >= sizeof(buf)) ! fatal("rcs_expand_keywords: truncated"); } if (kwtype & RCS_KW_DATE) { fmt = "%Y/%m/%d %H:%M:%S "; ! strftime(buf, sizeof(buf), fmt, &rdp->rd_date); ! if (strlcat(expbuf, buf, sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: string truncated"); } if (kwtype & RCS_KW_AUTHOR) { ! if (strlcat(expbuf, rdp->rd_author, sizeof(expbuf)) >= sizeof(expbuf) || ! strlcat(expbuf, " ", sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: string truncated"); } if (kwtype & RCS_KW_STATE) { ! if (strlcat(expbuf, rdp->rd_state, sizeof(expbuf)) >= sizeof(expbuf) || ! strlcat(expbuf, " ", sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: string truncated"); } /* order does not matter anymore below */ if (kwtype & RCS_KW_LOG) ! if (strlcat(expbuf, " ", sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: string truncated"); if (kwtype & RCS_KW_SOURCE) { ! if (strlcat(expbuf, rcsfile, sizeof(expbuf)) >= sizeof(expbuf) || ! strlcat(expbuf, " ", sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: string truncated"); } if (kwtype & RCS_KW_NAME) ! if (strlcat(expbuf, " ", sizeof(expbuf)) >= sizeof(expbuf)) ! fatal("rcs_expand_keywords: string truncated"); } /* end the expansion */