From: Boram Park Date: Tue, 7 Apr 2015 07:58:09 +0000 (+0900) Subject: string buffer can have a newline character X-Git-Tag: submit/tizen/20151116.055554~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f0d4236692556825efb0122ebb8c150b5d1326eb;p=platform%2Fupstream%2Fweston.git string buffer can have a newline character Change-Id: I44647f8bd17a6b3c83d160cff03354c0a02b222d --- diff --git a/shared/str-util.c b/shared/str-util.c index 448f7b04..e908ee0e 100644 --- a/shared/str-util.c +++ b/shared/str-util.c @@ -52,7 +52,8 @@ convert_strtol(const char *str, char **endptr, int base, long *val) errno = 0; v = strtol(str, endptr, base); - if (errno != 0 || *endptr == str || **endptr != '\0') + if (errno != 0 || *endptr == str || + (**endptr != '\0' && **endptr != '\n' && **endptr != '\r')) return false; errno = prev_errno; @@ -87,7 +88,8 @@ convert_strtoul (const char *str, char **endptr, int base, unsigned long *val) errno = 0; v = strtoul(str, endptr, base); - if (errno != 0 || *endptr == str || **endptr != '\0') + if (errno != 0 || *endptr == str || + (**endptr != '\0' && **endptr != '\n' && **endptr != '\r')) return false; errno = prev_errno;