diff options
author | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-11-24 19:36:11 +0000 |
---|---|---|
committer | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-11-24 19:36:11 +0000 |
commit | a44bf7617d9b5f641c1a92ddbb461af565b9f9b9 (patch) | |
tree | 3dfe5f0606b9dbc3e17d6e322081c1784a028f17 | |
parent | d8f5aa387085fd66bf2c160e3d84d3601e1c1217 (diff) |
fix use after free introduced in r1.30. ok deraadt@
-rw-r--r-- | usr.bin/calendar/io.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c index 70d9cd10d36..d0d85a4c418 100644 --- a/usr.bin/calendar/io.c +++ b/usr.bin/calendar/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.31 2005/11/16 16:45:11 deraadt Exp $ */ +/* $OpenBSD: io.c,v 1.32 2005/11/24 19:36:10 moritz Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -39,7 +39,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94"; #else -static const char rcsid[] = "$OpenBSD: io.c,v 1.31 2005/11/16 16:45:11 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: io.c,v 1.32 2005/11/24 19:36:10 moritz Exp $"; #endif #endif /* not lint */ @@ -207,11 +207,11 @@ cal(void) } } } else if (printing) { - free(ev1->ldesc); - if (asprintf(&ev1->ldesc, "%s\n%s", ev1->ldesc, + if (asprintf(&p, "%s\n%s", ev1->ldesc, buf) == -1) err(1, NULL); - + free(ev1->ldesc); + ev1->ldesc = p; } } tmp = events; |