Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit561ec76

Browse files
committed
psql: Fix invalid memory access
Due to an apparent thinko, when printing a table in expanded mode(\x), space would be allocated for 1 slot plus 1 byte per line,instead of 1 slot per line plus 1 slot for the NULL terminator. Whenthe line count is small, reading or writing the terminator wouldtherefore access memory beyond what was allocated.
1 parentf9325df commit561ec76

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/bin/psql/print.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,8 +1210,8 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout)
12101210
* We now have all the information we need to setup the formatting
12111211
* structures
12121212
*/
1213-
dlineptr=pg_local_malloc((sizeof(*dlineptr)+1)*dheight);
1214-
hlineptr=pg_local_malloc((sizeof(*hlineptr)+1)*hheight);
1213+
dlineptr=pg_local_malloc((sizeof(*dlineptr))*(dheight+1));
1214+
hlineptr=pg_local_malloc((sizeof(*hlineptr))*(hheight+1));
12151215

12161216
dlineptr->ptr=pg_local_malloc(dformatsize);
12171217
hlineptr->ptr=pg_local_malloc(hformatsize);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp