=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/rcs.c,v retrieving revision 1.9 retrieving revision 1.10 diff -c -r1.9 -r1.10 *** src/usr.bin/cvs/rcs.c 2004/08/12 21:02:20 1.9 --- src/usr.bin/cvs/rcs.c 2004/09/16 15:02:21 1.10 *************** *** 1,4 **** ! /* $OpenBSD: rcs.c,v 1.9 2004/08/12 21:02:20 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: rcs.c,v 1.10 2004/09/16 15:02:21 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 372,377 **** --- 372,383 ---- } symp->rs_name = strdup(sym); + if (symp->rs_name == NULL) { + cvs_log(LP_ERRNO, "failed to duplicate symbol"); + free(symp); + return (-1); + } + symp->rs_num = rcsnum_alloc(); rcsnum_cpy(snum, symp->rs_num, 0); *************** *** 724,729 **** --- 730,740 ---- } rfp->rf_desc = strdup(RCS_TOKSTR(rfp)); + if (rfp->rf_desc == NULL) { + cvs_log(LP_ERRNO, "failed to duplicate rcs token"); + rcs_freepdata(pdp); + return (-1); + } for (;;) { ret = rcs_parse_deltatext(rfp); *************** *** 810,818 **** --- 821,839 ---- } else if (tok == RCS_TOK_COMMENT) { rfp->rf_comment = strdup(RCS_TOKSTR(rfp)); + if (rfp->rf_comment == NULL) { + cvs_log(LP_ERRNO, + "failed to duplicate rcs token"); + return (-1); + } } else if (tok == RCS_TOK_EXPAND) { rfp->rf_expand = strdup(RCS_TOKSTR(rfp)); + if (rfp->rf_expand == NULL) { + cvs_log(LP_ERRNO, + "failed to duplicate rcs token"); + return (-1); + } } /* now get the expected semi-colon */ *************** *** 943,950 **** if (tokstr != NULL) free(tokstr); tokstr = strdup(RCS_TOKSTR(rfp)); - /* now get the expected semi-colon */ ntok = rcs_gettok(rfp); if (ntok != RCS_TOK_SCOLON) { --- 964,976 ---- if (tokstr != NULL) free(tokstr); tokstr = strdup(RCS_TOKSTR(rfp)); + if (tokstr == NULL) { + cvs_log(LP_ERRNO, + "failed to duplicate rcs token"); + rcs_freedelta(rdp); + return (-1); + } /* now get the expected semi-colon */ ntok = rcs_gettok(rfp); if (ntok != RCS_TOK_SCOLON) { *************** *** 1143,1148 **** --- 1169,1180 ---- return (-1); } symp->rs_name = strdup(RCS_TOKSTR(rfp)); + if (symp->rs_name == NULL) { + cvs_log(LP_ERRNO, "failed to duplicate rcs token"); + free(symp); + return (-1); + } + symp->rs_num = rcsnum_alloc(); type = rcs_gettok(rfp);