diff options
author | 2003-09-26 07:23:06 +0000 | |
---|---|---|
committer | 2003-09-26 07:23:06 +0000 | |
commit | ca50e754249834aac5be058c1d8a33ed7d8a875e (patch) | |
tree | 7ec1d938f3db7f91bdc003e8a2137b880a35c101 | |
parent | realloc tuning; pvalchev ok (diff) | |
download | wireguard-openbsd-ca50e754249834aac5be058c1d8a33ed7d8a875e.tar.xz wireguard-openbsd-ca50e754249834aac5be058c1d8a33ed7d8a875e.zip |
Check strdup() return value, as pointed out by deraadt@
-rw-r--r-- | usr.bin/bc/bc.y | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/bc/bc.y b/usr.bin/bc/bc.y index a201110a9b4..9059846d5d9 100644 --- a/usr.bin/bc/bc.y +++ b/usr.bin/bc/bc.y @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: bc.y,v 1.1 2003/09/25 19:32:44 otto Exp $ */ +/* $OpenBSD: bc.y,v 1.2 2003/09/26 07:23:06 otto Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net> @@ -31,7 +31,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: bc.y,v 1.1 2003/09/25 19:32:44 otto Exp $"; +static const char rcsid[] = "$OpenBSD: bc.y,v 1.2 2003/09/26 07:23:06 otto Exp $"; #endif /* not lint */ #include <ctype.h> @@ -607,6 +607,8 @@ as(const char *str) grow(); instructions[current].index = ALLOC_STRING; instructions[current].u.astr = strdup(str); + if (instructions[current].u.astr == NULL) + err(1, "cannot allocate string"); return current++; } |