Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)
От | Fabrízio de Royes Mello |
---|---|
Тема | Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c) |
Дата | |
Msg-id | CAFcNs+p2NSyT0Vs2gFxGwFn02jEj_DgHWK0N-F18EtENh-8TEw@mail.gmail.com обсуждение исходный текст |
Ответ на | Avoid incomplete copy string (src/backend/access/transam/xlog.c) (Ranier Vilela <ranier.vf@gmail.com>) |
Ответы |
Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)
Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c) |
Список | pgsql-hackers |
Hi.In src/include/access/xlogbackup.h, the field *name*has one byte extra to store null-termination.But, in the function *do_pg_backup_start*,I think that is a mistake in the line (8736):memcpy(state->name, backupidstr, strlen(backupidstr));memcpy with strlen does not copy the whole string.strlen returns the exact length of the string, withoutthe null-termination.So, I think this can result in errors,like in the function *build_backup_content* (src/backend/access/transam/xlogbackup.c)Where *appendStringInfo* expects a string with null-termination.appendStringInfo(result, "LABEL: %s\n", state->name);To fix, copy strlen size plus one byte, to include the null-termination.
Fabrízio de Royes Mello
В списке pgsql-hackers по дате отправления: