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

Commit45e7e8c

Browse files
Convert strncpy to strlcpy
We try to avoid using strncpy() due to the ease of which it canbe misused. Convert this callsite to use strlcpy() instead tomatch similar codepaths in this file.Suggested-by: Peter Eisentraut <peter@eisentraut.org>Discussion:https://postgr.es/m/2a796830-de2d-4030-b480-d673f6cc5d94@eisentraut.org
1 parent2d6745a commit45e7e8c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

‎src/backend/utils/mmgr/mcxt.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,8 +1664,7 @@ ProcessGetMemoryContextInterrupt(void)
16641664
num_individual_stats=context_id+1;
16651665
meminfo[max_stats-1].name=dsa_allocate(MemoryStatsDsaArea,namelen+1);
16661666
nameptr=dsa_get_address(MemoryStatsDsaArea,meminfo[max_stats-1].name);
1667-
strncpy(nameptr,"Remaining Totals",namelen);
1668-
nameptr[namelen]='\0';
1667+
strlcpy(nameptr,"Remaining Totals",namelen+1);
16691668
meminfo[max_stats-1].ident=InvalidDsaPointer;
16701669
meminfo[max_stats-1].path=InvalidDsaPointer;
16711670
meminfo[max_stats-1].type=0;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp