[RFC PATCH 0/1] env: introduce variable value ranges

lukas.funke-oss at weidmueller.com lukas.funke-oss at weidmueller.com
Mon Aug 26 14:51:10 CEST 2024


From: Lukas Funke <lukas.funke at weidmueller.com>


This series extends the flags-variable with ranges for environment
variables. The range is appended to the variable flags using
the '@'-character. A range can be decimal (min/max), bitmask or regular
expression (64 byte).

Value ranges for variables can be used to make the environment more
robust against faults such as invalid user input or attacks.

Decimal-range:  foo:da@<min>-<max>
Hexadecimal-range(bitmask): bar:xa at 0xdeadbeed
Regex-range: mystring:sa at r"klaus|haus|maus"

Example:

	"decimalvalue:dw at 100-200,"
    ...

=> env set decimalvalue 1
1 < 100 || 1 > 200
=> env set decimalvalue 150
=>



Lukas Funke (1):
  env: introduce variable ranges

 cmd/nvedit.c              |  30 +++---
 env/flags.c               | 217 +++++++++++++++++++++++++++++++++++++-
 include/configs/sandbox.h |   5 +
 include/env_flags.h       |  27 ++++-
 include/search.h          |   1 +
 test/env/Makefile         |   1 +
 test/env/range.c          | 113 ++++++++++++++++++++
 7 files changed, 377 insertions(+), 17 deletions(-)
 create mode 100644 test/env/range.c

-- 
2.30.2



More information about the U-Boot mailing list