From: | Michael Meskes <meskes(at)postgresql(dot)org> |
---|---|
To: | "postgresql_2016(at)163(dot)com" <postgresql_2016(at)163(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: 【ECPG】strncpy function does not set the end character '\0' |
Date: | 2017-09-06 07:41:59 |
Message-ID: | 1504683719.2640.84.camel@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> When we reviewed the ecpg code,we found the array seem not have the
> end
> character('\0') after using the strncpy function.
True.
> In the function ECPGnoticeReceiver, we use the stncpy function copy
> the
> sqlstate to sqlca->sqlstate. And the sqlca->sqlstate is defined as
> the size
> of 5, and the copy size is sizeof(sqlca->sqlstate). However, from the
> previous strcmp function, the sqlstate size may be 5,such as
> ECPG_SQLSTATE_INVALID_CURSOR_NAME. So there may be lack of the end
> character
> for sqlca->sqlstate.
Why do you think there should be one? My memory might be wrong but I
don't think it's supposed to be a null terminated string.
Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! SF 49ers! Use Debian GNU/Linux, PostgreSQL
From | Date | Subject | |
---|---|---|---|
Next Message | Haribabu Kommi | 2017-09-06 07:45:20 | Re: VACUUM and ANALYZE disagreeing on what reltuples means |
Previous Message | Michael Paquier | 2017-09-06 07:40:21 | Re: document and use SPI_result_code_string() |