diff options
author | 2002-08-06 11:25:05 +0000 | |
---|---|---|
committer | 2002-08-06 11:25:05 +0000 | |
commit | db9f75c528e107a53a84672fa6b1732dc7abfed4 (patch) | |
tree | 69ea23cf5a97a2e26c9c5f622d872cecfe77df32 | |
parent | restore link_map ABI compatibility between gdb and ld.so. this comes from (diff) | |
download | wireguard-openbsd-db9f75c528e107a53a84672fa6b1732dc7abfed4.tar.xz wireguard-openbsd-db9f75c528e107a53a84672fa6b1732dc7abfed4.zip |
check fo strdup() allocation errors
pointed out by mpech@
ok pb@
-rw-r--r-- | sbin/pfctl/parse.y | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 051d52a4715..19c5a5a4310 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.137 2002/07/31 20:19:14 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.138 2002/08/06 11:25:05 henning Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -1448,7 +1448,10 @@ route : /* empty */ { $$.addr = NULL; } | ROUTETO '(' STRING address ')' { - $$.string = strdup($3); + if (($$.string = strdup($3)) == NULL) { + yyerror("routeto: strdup"); + YYERROR; + } $$.rt = PF_ROUTETO; if ($4->addr.addr_dyn != NULL) { yyerror("route-to does not support" @@ -1463,12 +1466,18 @@ route : /* empty */ { $$.af = $4->af; } | ROUTETO STRING { - $$.string = strdup($2); + if (($$.string = strdup($2)) == NULL) { + yyerror("routeto: strdup"); + YYERROR; + } $$.rt = PF_ROUTETO; $$.addr = NULL; } | DUPTO '(' STRING address ')' { - $$.string = strdup($3); + if (($$.string = strdup($3)) == NULL) { + yyerror("dupto: strdup"); + YYERROR; + } $$.rt = PF_DUPTO; if ($4->addr.addr_dyn != NULL) { yyerror("dup-to does not support" @@ -1483,7 +1492,10 @@ route : /* empty */ { $$.af = $4->af; } | DUPTO STRING { - $$.string = strdup($2); + if (($$.string = strdup($2)) == NULL) { + yyerror("dupto: strdup"); + YYERROR; + } $$.rt = PF_DUPTO; $$.addr = NULL; } |