pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pavel Raiskup <praiskup@redhat.com>
To: psql-odbc <pgsql-odbc@postgresql.org>
Subject: Static analysis fix request
Date: Mon, 06 Jan 2014 10:00:41 +0100
Message-ID: <38586059.r5Bu4hye1i@nb.usersys.redhat.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

* Attached fix for overrun.  This is imo worth fixing.

* Attached added gcc & Coverity warnings (added between 9.2.1 and 9.3.1)

Pavel

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Attachments:

0001-Fix-off-by-one-overrun.patch (text/x-patch, 1.4K) download From f891d6a35c28fc25bae39ac466b9ae203f219eb5 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup <praiskup@redhat.com> Date: Mon, 6 Jan 2014 09:26:43 +0100 Subject: [PATCH] Fix off-by-one overrun Detected by Coverity --- info.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/info.c b/info.c index 9fd034f..14e3876 100644 --- a/info.c +++ b/info.c @@ -1686,11 +1686,11 @@ retry_public_schema: #else prefix[i] = strtok(prefixes, ";"); #endif /* HAVE_STRTOK_R */ - while (i < sizeof(prefix) / sizeof(char *) && prefix[i]) + for (i++; i < sizeof(prefix) / sizeof(char *) && prefix[i]; i++) #ifdef HAVE_STRTOK_R - prefix[++i] = strtok_r(NULL, ";", &last); + prefix[i] = strtok_r(NULL, ";", &last); #else - prefix[++i] = strtok(NULL, ";"); + prefix[i] = strtok(NULL, ";"); #endif /* HAVE_STRTOK_R */ /* Parse the desired table types to return */ @@ -1720,11 +1720,11 @@ retry_public_schema: #else table_type[i] = strtok(table_types, ","); #endif /* HAVE_STRTOK_R */ - while (i < sizeof(table_type) / sizeof(char *) && table_type[i]) + for (i++; i < sizeof(table_type) / sizeof(char *) && table_type[i]; i++) #ifdef HAVE_STRTOK_R - table_type[++i] = strtok_r(NULL, ",", &last); + table_type[i] = strtok_r(NULL, ",", &last); #else - table_type[++i] = strtok(NULL, ","); + table_type[i] = strtok(NULL, ","); #endif /* HAVE_STRTOK_R */ /* Check for desired table types to return */ -- 1.8.4.2
coverity_and_gcc.err.zip (application/zip, 16.3K) download

view thread (4+ messages)  latest in thread

Message-ID: <38586059.r5Bu4hye1i@nb.usersys.redhat.com>
Permalink:  ../38586059.r5Bu4hye1i@nb.usersys.redhat.com/
Also on:    postgresql.org/message-id/38586059.r5Bu4hye1i@nb.usersys.redhat.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: praiskup@redhat.com
  Subject: Re: Static analysis fix request
  In-Reply-To: <38586059.r5Bu4hye1i@nb.usersys.redhat.com>
  References: <38586059.r5Bu4hye1i@nb.usersys.redhat.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox