Re: [HACKERS] 【ECPG】strncpy function does not set the end character '\0'

2017-09-07 Thread Michael Meskes
> Oh. If there's actually a standard somewhere that says it's not > null-terminated, then code that is expecting it to be so is just > wrong. No need to change anything in ecpg, IMO. As I said I haven't checked if this detail is actually in there, but I guess it was because there is a reason

Re: [HACKERS] 【ECPG】strncpy function does not set the end character '\0'

2017-09-07 Thread Tom Lane
Michael Meskes writes: > With "supposed" I was referring to the standard that defines SQLCA. Oh. If there's actually a standard somewhere that says it's not null-terminated, then code that is expecting it to be so is just wrong. No need to change anything in ecpg, IMO.

Re: [HACKERS] 【ECPG】strncpy function does not set the end character '\0'

2017-09-07 Thread Michael Meskes
> > 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. > > That field is defined as char[5] in struct sqlca_t, so the intent is > clearly that it not be null terminated. However, it looks to me like > there'd be

Re: [HACKERS] 【ECPG】strncpy function does not set the end character '\0'

2017-09-06 Thread Tom Lane
Michael Meskes writes: >> 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

Re: [HACKERS] 【ECPG】strncpy function does not set the end character '\0'

2017-09-06 Thread Michael Meskes
> 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 >

[HACKERS] 【ECPG】strncpy function does not set the end character '\0'

2017-09-04 Thread postgresql_2...@163.com
Hi When we reviewed the ecpg code,we found the array seem not have the end character('\0') after using the strncpy function. 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