diff options
author | 2012-11-12 14:07:20 +0000 | |
---|---|---|
committer | 2012-11-12 14:07:20 +0000 | |
commit | 783b3afc39373ad0296f5e34a69ec642e5e1e25b (patch) | |
tree | 25570f8942155eb7951921bd01d40818b8669d39 | |
parent | fix a potential memory leak; OK martinh@ sthen@ (diff) | |
download | wireguard-openbsd-783b3afc39373ad0296f5e34a69ec642e5e1e25b.tar.xz wireguard-openbsd-783b3afc39373ad0296f5e34a69ec642e5e1e25b.zip |
make scan_scaled set errno to EINVAL rather than ERANGE if it encounters
an invalid multiplier, like the man page says it should
"looks sensible" deraadt@, ok ian@
-rw-r--r-- | lib/libutil/fmt_scaled.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libutil/fmt_scaled.c b/lib/libutil/fmt_scaled.c index 58f8d2452a0..83f9fa91fc0 100644 --- a/lib/libutil/fmt_scaled.c +++ b/lib/libutil/fmt_scaled.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fmt_scaled.c,v 1.10 2009/06/20 15:00:04 martynas Exp $ */ +/* $OpenBSD: fmt_scaled.c,v 1.11 2012/11/12 14:07:20 halex Exp $ */ /* * Copyright (c) 2001, 2002, 2003 Ian F. Darwin. All rights reserved. @@ -177,7 +177,9 @@ scan_scaled(char *scaled, long long *result) return 0; } } - errno = ERANGE; + + /* Invalid unit or character */ + errno = EINVAL; return -1; } |