| From: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
|---|---|
| To: | o(dot)tselebrovskiy(at)postgrespro(dot)ru |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Returning non-terminated string in ECPG Informix-compatible function |
| Date: | 2024-01-30 07:12:37 |
| Message-ID: | CAExHW5u-cBgFJLPHzjDSdOy2QA9wJRireaYCngVQqqC5oGxhOA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Jan 29, 2024 at 2:17 PM <o(dot)tselebrovskiy(at)postgrespro(dot)ru> wrote:
>
> Greetings, everyone!
>
> While analyzing output of Svace static analyzer [1] I've found a bug.
>
> In function intoasc(interval * i, char *str) from file
> src/interfaces/ecpg/compatlib/informix.c
> we return a non-terminated string since we use memcpy on tmp which is
> itself NULL-teminated but
> last zero byte is not copied.
>
> The proposed solution is to use strcpy instead, since it is used in all
> other functions in informix.c.
>
> The patch is attached.
>
> [1] - https://svace.pages.ispras.ru/svace-website/en/
>
Can you please add a test case showcasing the bug? I see dttoasc()
uses strcpy(). So there's already a precedence.
--
Best Wishes,
Ashutosh Bapat
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ashutosh Bapat | 2024-01-30 07:20:29 | Re: Incorrect cost for MergeAppend |
| Previous Message | jian he | 2024-01-30 06:57:20 | Re: pg_column_toast_chunk_id: a function to get a chunk ID of a TOASTed value |