Commit Graph

22 Commits

Author SHA1 Message Date
Ivan Kozlovic
86d20aa5e6 [FIXED] Parsing of strings starting with numbers and K/G/etc.. suffix
If a configuration variable starts with numbers and has a character
that such as K/k/G/g/etc.. it would assume that it was a number
(expressed in Kb, Gb, etc..).

This PR checks that if the special characters are not the suffix,
that is, the variable does not end after those characters, then
the parsing will treat the whole thing as a string.

Resolves #3431

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-09-02 18:15:04 -06:00
Matthias Hanel
fc667aaafd [fiixed] infinite loop in config parser for include with quote and double quote
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-01-08 13:17:19 -05:00
Matthias Hanel
4649f9e691 [fixed] timeout in configuration lexer found by oss-fuzz (#1792)
* [fixed] timeout in configuration lexer found by oss-fuzz

Peek followed by next resulted in an infinite loop when eof was not
checked.
I looked for all instances of this pattern and return an error when eof is not already checked or skip was used.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-01-05 20:07:19 -05:00
Waldemar Quevedo
c9ff9c45a4 Run go fmt on tests
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2020-10-28 20:49:47 -07:00
Waldemar Quevedo
2047ed4537 Add support for base2 units in NATS config
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2020-10-28 13:52:35 -07:00
Waldemar Quevedo
ff357d8317 Revert "Allow using quotes around include" 2019-04-25 18:02:01 -07:00
Derek Collison
46a2661114 Merge pull request #891 from wallyqs/include-parsing-fixes
Allow using quotes around include
2019-02-06 11:57:40 -08:00
Waldemar Quevedo
457c442198 Show parse errors from looked up env vars
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2019-02-06 08:57:08 -08:00
Waldemar Quevedo
441d865c1c Allow using quotes around include
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2019-01-31 09:44:20 -08:00
Ivan Kozlovic
7449e9ac53 Replace megacheck with staticcheck
Fixed issues reported by staticcheck

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-01-09 14:14:47 -07:00
Waldemar Quevedo
18cb7ed49a Fix position reporting of variables and bcrypt values
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2018-10-03 15:02:49 -07:00
Derek Collison
6b307af1eb Add more options for Booleans 2016-11-21 15:06:15 -08:00
Derek Collison
e57c949658 Add support for 'include' to configuration files 2016-11-21 14:58:05 -08:00
Derek Collison
6f9e4d6512 Added support for integer suffixes, e.g. 1k, 8mb 2016-11-20 17:39:04 -08:00
Derek Collison
8f4b31b5ed Special case raw bcrypted passwords 2016-05-22 10:41:16 -07:00
Derek Collison
832bac98be First pass variable support.
This allows blocked scoped variables to be set and retrieved as values using the $ prefix.
e.g. foo = 22; bar = $foo

Also supports env variables being used as variables and will properly parse to the correct type.
2016-05-22 10:21:00 -07:00
Derek Collison
296227e46e parse test coverage 2016-05-04 13:59:48 -07:00
Peter Ohler
e6b5c41e54 fixed problem with parsing arrays 2013-08-21 08:51:25 -07:00
Peter Ohler
e391e6f696 added support for blocks and removed feature that allowed mixed single and double quotes 2013-08-12 09:48:52 -07:00
Derek Collison
377ade5e42 go fmt 2013-08-02 16:52:08 -07:00
Derek Collison
3ef0c2329a Fixed bug with block comments inside maps 2013-07-27 13:32:57 -07:00
Derek Collison
ee17979d6a Added first pass parser 2013-03-25 20:29:42 -07:00