Content-Length: 259466 | pFad | http://github.com/postgrespro/postgres/commit/e930c872b65c19c8950556fa94aa9ab53b2919b0

CB Use safe string copy routine · postgrespro/postgres@e930c87 · GitHub
Skip to content

Commit e930c87

Browse files
Use safe string copy routine
Using memcpy with strlen as the size parameter will not take the NULL terminator into account, relying instead on the destination buffer being properly initialized. Replace with strlcpy which is a safer alternative, and more in line with how we handle copying strings elsewhere. Author: Ranier Vilela <ranier.vf@gmail.com> Discussion: https://postgr.es/m/CAEudQApAsbLsQ+gGiw-hT+JwGhgogFa_=5NUkgFO6kOPxyNidQ@mail.gmail.com
1 parent da3ea04 commit e930c87

File tree

1 file changed

+1
-1
lines changed
  • src/backend/access/transam

1 file changed

+1
-1
lines changed

src/backend/access/transam/xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8744,7 +8744,7 @@ do_pg_backup_start(const char *backupidstr, bool fast, List **tablespaces,
87448744
errmsg("backup label too long (max %d bytes)",
87458745
MAXPGPATH)));
87468746

8747-
memcpy(state->name, backupidstr, strlen(backupidstr));
8747+
strlcpy(state->name, backupidstr, sizeof(state->name));
87488748

87498749
/*
87508750
* Mark backup active in shared memory. We must do full-page WAL writes

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/e930c872b65c19c8950556fa94aa9ab53b2919b0

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy