fix some use-after-free's, and don't hardcode -O3

ok sthen@, reminded by claudio@
This commit is contained in:
phessler 2010-08-22 11:49:55 +00:00
parent 7fc2fcb245
commit 78e04e02c9
3 changed files with 44 additions and 1 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.1.1.1 2010/08/17 19:48:36 sthen Exp $
# $OpenBSD: Makefile,v 1.2 2010/08/22 11:49:55 phessler Exp $
COMMENT= library to analyze MRT-format BGP dump files
DISTNAME= libbgpdump-1.4.99.11
REVISION= 0
SHARED_LIBS= bgpdump 0.0

View File

@ -0,0 +1,27 @@
$OpenBSD: patch-cfile_tools_c,v 1.1 2010/08/22 11:49:55 phessler Exp $
Use after free
--- cfile_tools.c.orig Wed Apr 21 14:32:21 2010
+++ cfile_tools.c Wed Apr 21 14:32:58 2010
@@ -218,8 +218,8 @@ int cfr_close(CFRFILE *stream) {
return(-1);
}
retval = fclose((FILE *)(stream->data1));
- free(stream);
stream->error1 = retval;
+ free(stream);
return(retval);
}
break;
@@ -229,9 +229,9 @@ int cfr_close(CFRFILE *stream) {
{
if(stream->data2!=NULL) {
retval=gzclose(stream->data2);
- free(stream);
}
stream->error2 = retval;
+ free(stream);
return(retval);
}
break;

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-configure,v 1.1 2010/08/22 11:49:55 phessler Exp $
Don't hardcode -O3
--- configure.orig Wed Nov 25 13:42:53 2009
+++ configure Wed Aug 18 12:21:15 2010
@@ -1788,7 +1788,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers bgpdump-config.h"
-CFLAGS="$CFLAGS -Wall -Wcast-align -Wsystem-headers -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -O3"
+CFLAGS="$CFLAGS -Wall -Wcast-align -Wsystem-headers -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter "
# Checks for programs.
ac_ext=c