diff options
author | Dan Albert <danalbert@google.com> | 2014-12-11 11:23:50 -0800 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2014-12-11 11:23:50 -0800 |
commit | 9e08c51eb432004366b07632650b0dfe02bf7160 (patch) | |
tree | 59afba1ed0d6c69734eafad631607107e625d5e3 | |
parent | c24d01d337ab3d449dd21f50adb882af1aae3f66 (diff) | |
download | checkpolicy-9e08c51eb432004366b07632650b0dfe02bf7160.tar.gz |
Clear errno before call to strtol(3).
Since strtol(3) doesn't clear errno on success, anything that sets
errno prior to this call will make it look like the call failed. This
happens when built with ASAN.
Signed-off-by: Dan Albert <danalbert@google.com>
Acked-by: Steve Lawrence <slawrence@tresys.com>
Change-Id: Iddc2420c60f68b267df2af951620e92b3c8c14db
-rw-r--r-- | checkpolicy.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/checkpolicy.c b/checkpolicy.c index 292f568..2a09734 100644 --- a/checkpolicy.c +++ b/checkpolicy.c @@ -452,7 +452,9 @@ int main(int argc, char **argv) mlspol = 1; break; case 'c':{ - long int n = strtol(optarg, NULL, 10); + long int n; + errno = 0; + n = strtol(optarg, NULL, 10); if (errno) { fprintf(stderr, "Invalid policyvers specified: %s\n", |