Re: [HACKERS] 【ECPG】strncpy function does not set the end character '\0'
От | Michael Meskes |
---|---|
Тема | Re: [HACKERS] 【ECPG】strncpy function does not set the end character '\0' |
Дата | |
Msg-id | 1504683719.2640.84.camel@postgresql.org обсуждение исходный текст |
Ответ на | [HACKERS] 【ECPG】strncpy function does not set the end character '\0' ("postgresql_2016@163.com" <postgresql_2016@163.com>) |
Ответы |
Re: [HACKERS] 【ECPG】strncpy function does not set the end character '\0'
|
Список | 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
В списке pgsql-hackers по дате отправления: