Mercurial > hg > octave-nkf
changeset 11560:05b5bcdb09c8
validate opts in lookup
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 17 Jan 2011 22:19:29 +0100 |
parents | 26a6435857bc |
children | 1140bd9f9b21 |
files | src/ChangeLog src/DLD-FUNCTIONS/lookup.cc |
diffstat | 2 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-01-17 Jaroslav Hajek <highegg@gmail.com> + + * DLD-FUNCTION/lookup.cc (Flookup): Validate option string. + 2011-01-17 John W. Eaton <jwe@octave.org> * ov-usr-fcn.cc (octave_user_function::bind_automatic_vars):
--- a/src/DLD-FUNCTIONS/lookup.cc +++ b/src/DLD-FUNCTIONS/lookup.cc @@ -264,6 +264,12 @@ right_inf = contains_char (opt, 'r'); match_idx = contains_char (opt, 'm'); match_bool = contains_char (opt, 'b'); + if (opt.find_first_not_of ("lrmb") != std::string::npos) + { + error ("lookup: unrecognized option: %c", + opt[opt.find_first_not_of ("lrmb")]); + return retval; + } } if ((match_idx || match_bool) && (left_inf || right_inf))