Skip to content

Commit 4d3cfb6

Browse files
committed
fix safety warning
1 parent 91df9f4 commit 4d3cfb6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cpp/findpath.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ size_t MapSearchNode::Hash()
119119

120120
void MapSearchNode::PrintNodeInfo()
121121
{
122-
char str[100];
123-
sprintf( str, "Node position : (%d,%d)\n", x,y );
122+
const int strSize = 100;
123+
char str[strSize];
124+
snprintf( str, strSize, "Node position : (%d,%d)\n", x,y );
124125

125126
cout << str;
126127
}

0 commit comments

Comments
 (0)