mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
Extract numeric string arguments with the correct signedness
There are lots of places where a numeric argument of an argument string gets extraced as signed long value and then assigned to an unsigned long variable. If the value in the string was negative, it would not be detected as invalid (and replaced by the default value), but become a positive bogus value. With this patch, numeric values which are supposed to be unsigned get extracted with the 'ulong_value()' function, which returns the default value for negative numbers. Fixes #1472
This commit is contained in:
committed by
Norman Feske
parent
af2cd7175c
commit
0fd53c7fe4
@@ -210,7 +210,7 @@ class Genode::Root_component : public Rpc_object<Typed_root<SESSION_TYPE> >,
|
||||
* We need to decrease 'ram_quota' by
|
||||
* the size of the session object.
|
||||
*/
|
||||
size_t ram_quota = Arg_string::find_arg(args.string(), "ram_quota").long_value(0);
|
||||
size_t ram_quota = Arg_string::find_arg(args.string(), "ram_quota").ulong_value(0);
|
||||
size_t needed = sizeof(SESSION_TYPE) + md_alloc()->overhead(sizeof(SESSION_TYPE));
|
||||
|
||||
if (needed > ram_quota) {
|
||||
|
||||
Reference in New Issue
Block a user