Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)
Daniel Gustafsson <daniel@yesql.se>
From: Daniel Gustafsson <daniel@yesql.se>
To: Ranier Vilela <ranier.vf@gmail.com>
Cc: Yugo NAGATA <nagata@sraoss.co.jp>,
Richard Guo <guofenglinux@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2024-07-01T09:20:19Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Use safe string copy routine
- e930c872b65c 18.0 landed
> On 27 Jun 2024, at 13:50, Ranier Vilela <ranier.vf@gmail.com> wrote: > Now with file patch really attached. - if (strlen(backupidstr) > MAXPGPATH) + if (strlcpy(state->name, backupidstr, sizeof(state->name)) >= sizeof(state->name)) ereport(ERROR, Stylistic nit perhaps, I would keep the strlen check here and just replace the memcpy with strlcpy. Using strlen in the error message check makes the code more readable. - char name[MAXPGPATH + 1]; + char name[MAXPGPATH];/* backup label name */ With the introduced use of strlcpy, why do we need to change this field? -- Daniel Gustafsson