diff options
author | Kjell Wooding <kjell@cvs.openbsd.org> | 2005-11-12 18:48:09 +0000 |
---|---|---|
committer | Kjell Wooding <kjell@cvs.openbsd.org> | 2005-11-12 18:48:09 +0000 |
commit | 7a9c67ed287c3650e16512ed303fcbf33e0f714b (patch) | |
tree | e162a44585c2e23d05fa332ec2973733e26c2534 /usr.bin | |
parent | 8c5b9b2a28ebd56052885f36227c81cd89471f07 (diff) |
Paranoia. Check if last of a series of strlcats overflows. Pointed out by
Han Boetes.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mg/undo.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/mg/undo.c b/usr.bin/mg/undo.c index f65006f32dd..3938427c254 100644 --- a/usr.bin/mg/undo.c +++ b/usr.bin/mg/undo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: undo.c,v 1.32 2005/10/14 19:46:46 kjell Exp $ */ +/* $OpenBSD: undo.c,v 1.33 2005/11/12 18:48:08 kjell Exp $ */ /* * Copyright (c) 2002 Vincent Labrecque <vincent@openbsd.org> * All rights reserved. @@ -385,7 +385,10 @@ undo_dump(int f, int n) strlcat(buf, "\"", sizeof(buf)); } snprintf(tmp, sizeof(tmp), " [%d]", rec->region.r_size); - strlcat(buf, tmp, sizeof(buf)); + if (strlcat(buf, tmp, sizeof(buf)) >= sizeof(buf)) { + ewprintf("Undo record too large. Aborted."); + return (FALSE); + } addlinef(bp, "%s", buf); } return (TRUE); |