From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 12FCF29C43 for ; Mon, 25 Mar 2019 11:14:55 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sXB4CGzDJ37j for ; Mon, 25 Mar 2019 11:14:54 -0400 (EDT) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id B03541FDE3 for ; Mon, 25 Mar 2019 11:14:54 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: [tarantool-patches] Re: [PATCH 11/13] sql: fixes an error in string to int64 conversion From: "n.pettik" In-Reply-To: Date: Mon, 25 Mar 2019 18:14:52 +0300 Content-Transfer-Encoding: 7bit Message-Id: <4470D3E0-963C-4CC6-A80A-91E25DE158DE@tarantool.org> References: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: szudin@tarantool.org See comments to the first patch. Should be skipped or squashed with first patch. > Returns an error if length of the recognized > string is less than length of the token. > --- > src/box/sql/util.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/box/sql/util.c b/src/box/sql/util.c > index 980932f3b..17268aaaa 100644 > --- a/src/box/sql/util.c > +++ b/src/box/sql/util.c > @@ -599,6 +599,7 @@ sqlAtoF(const char *z, double *pResult, int length) > enum atoi_result > sql_atoi64(const char *z, int64_t *val, int length) > { > + const char* expected_end = z + length; > int neg = 0; /* assume positive */ > const char *zEnd = z + length; > int incr = 1; > @@ -614,7 +615,7 @@ sql_atoi64(const char *z, int64_t *val, int length) > > char* end = NULL; > u64 u = strtoull(z, &end, 10); > - if (end == z) > + if (end < expected_end) > return ATOI_OVERFLOW; > if (errno == ERANGE) > return ATOI_OVERFLOW; > -- > 2.17.1 > >