diff options
author | Mark Salyzyn <salyzyn@google.com> | 2013-11-22 07:38:46 -0800 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2014-01-27 15:07:58 -0800 |
commit | b957baccd21ca43371dfbc02c10aae18497000b8 (patch) | |
tree | 8a90de09cf1d3e5013a7a83d5f3de3807b487ce2 | |
parent | 2b94cc264f54fb588a8721caf92fff95b7576f4a (diff) | |
download | system_core-b957baccd21ca43371dfbc02c10aae18497000b8.zip system_core-b957baccd21ca43371dfbc02c10aae18497000b8.tar.gz system_core-b957baccd21ca43371dfbc02c10aae18497000b8.tar.bz2 |
libcutils: bug str_parms.c:str_parms_get_float().
str_parms_get_float did not return the output into
*val. Only output if returning with no error. Audit
shows no internal users of this library function
(cherry picked from commit 8e71ddeac00d0733c7fcc2965d69f07aa5c5d0a3)
Change-Id: I14a3f08a098072a159dd93f85ead36b3f445816f
-rw-r--r-- | libcutils/str_parms.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libcutils/str_parms.c b/libcutils/str_parms.c index f1f3584..7cfbcb3 100644 --- a/libcutils/str_parms.c +++ b/libcutils/str_parms.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 The Android Open Source Project + * Copyright (C) 2011-2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -280,10 +280,11 @@ int str_parms_get_float(struct str_parms *str_parms, const char *key, return -ENOENT; out = strtof(value, &end); - if (*value != '\0' && *end == '\0') - return 0; + if (*value == '\0' || *end != '\0') + return -EINVAL; - return -EINVAL; + *val = out; + return 0; } static bool combine_strings(void *key, void *value, void *context) |