Bugzilla – Attachment 54912 Details for
Bug 129681
"cvs up" segfaults on corrupt repository file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
Patch adding a sanity check to RCS_parsercsfile_i() guarding against corrupted repository files
cvs-1.12.12-rcsfile-sanity.diff (text/plain), 2.20 KB, created by
Olaf Dabrunz
on 2005-10-20 11:25:54 UTC
(
hide
)
Description:
Patch adding a sanity check to RCS_parsercsfile_i() guarding against corrupted repository files
Filename:
MIME Type:
Creator:
Olaf Dabrunz
Created:
2005-10-20 11:25:54 UTC
Size:
2.20 KB
patch
obsolete
> src/rcs.c | 24 ++++++++++++++++++++++++ > 1 files changed, 24 insertions(+) > >Index: src/rcs.c >=================================================================== >--- src/rcs.c.orig 2005-04-15 23:38:22.000000000 +0200 >+++ src/rcs.c 2005-10-20 13:04:45.000000000 +0200 >@@ -166,6 +166,25 @@ > > #define whitespace(c) (spacetab[(unsigned char)c] != 0) > >+static const char invalidtab[] = { >+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, /* 0x00 - 0x0f */ >+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x10 - 0x1f */ >+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 - 0x2f */ >+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 - 0x3f */ >+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x4f */ >+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 - 0x5f */ >+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x8f */ >+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /* 0x70 - 0x7f */ >+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x80 - 0x8f */ >+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x90 - 0x9f */ >+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0 - 0xaf */ >+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0 - 0xbf */ >+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0 - 0xcf */ >+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0 - 0xdf */ >+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0 - 0xef */ >+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* 0xf0 - 0xff */ >+}; >+ > static char *rcs_lockfile = NULL; > static int rcs_lockfd = -1; > >@@ -1107,9 +1126,11 @@ > { > register const char * const my_spacetab = spacetab; > register char *ptr, *ptrend; >+ register const char * const my_invalidtab = invalidtab; > char c; > > #define my_whitespace(c) (my_spacetab[(unsigned char)c] != 0) >+#define my_invalid(c) (my_invalidtab[(unsigned char)c] != 0) > > rcsbuf->vlen = 0; > rcsbuf->at_string = 0; >@@ -1186,6 +1207,9 @@ > c = *ptr; > if (c == ';' || my_whitespace (c)) > break; >+ /* Sanity check: is this character invalid for a key (and not whitespace)? */ >+ if (my_invalid (c)) >+ return 0; > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 129681
: 54912