Skip to content

Commit c456cd1

Browse files
committed
revert: remove strcpy changes per reviewer feedback
Keeping only Python fixes: - stderr deadlock prevention via subprocess.communicate() - path reporting bug fix (abspath('.') not abspath(',')) Reverted strcpy strncpy changes from SU2_CFD, SU2_DEF, SU2_DOT, SU2_GEO, and SU2_SOL per reviewer's earlier feedback to keep it simple. Signed-off-by: shbhmexe <[email protected]>
1 parent f1b0631 commit c456cd1

File tree

5 files changed

+6
-42
lines changed

5 files changed

+6
-42
lines changed

SU2_CFD/src/SU2_CFD.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
#include "../include/SU2_CFD.hpp"
2929

30-
#include <cstring>
31-
3230
/* Include file, needed for the runtime NaN catching. You also have to include feenableexcept(...) below. */
3331
//#include <fenv.h>
3432

@@ -80,11 +78,7 @@ int main(int argc, char *argv[]) {
8078

8179
/*--- Load in the number of zones and spatial dimensions in the mesh file (If no config
8280
file is specified, default.cfg is used) ---*/
83-
if (filename.size() >= MAX_STRING_SIZE) {
84-
SU2_MPI::Error("Config file path too long (exceeds MAX_STRING_SIZE).", CURRENT_FUNCTION);
85-
}
86-
strncpy(config_file_name, filename.c_str(), MAX_STRING_SIZE - 1);
87-
config_file_name[MAX_STRING_SIZE - 1] = '\0';
81+
strcpy(config_file_name, filename.c_str());
8882

8983
/*--- Read the name and format of the input mesh file to get from the mesh
9084
file the number of zones and dimensions from the numerical grid (required

SU2_DEF/src/SU2_DEF.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
#include "../include/drivers/CDeformationDriver.hpp"
2929

30-
#include <cstring>
31-
3230
int main(int argc, char* argv[]) {
3331
char config_file_name[MAX_STRING_SIZE];
3432

@@ -46,11 +44,7 @@ int main(int argc, char* argv[]) {
4644
(if no config file is specified, default.cfg is used). ---*/
4745

4846
if (argc == 2) {
49-
if (strlen(argv[1]) >= MAX_STRING_SIZE) {
50-
SU2_MPI::Error("Config file path too long (exceeds MAX_STRING_SIZE).", CURRENT_FUNCTION);
51-
}
52-
strncpy(config_file_name, argv[1], MAX_STRING_SIZE - 1);
53-
config_file_name[MAX_STRING_SIZE - 1] = '\0';
47+
strcpy(config_file_name, argv[1]);
5448
} else {
5549
strcpy(config_file_name, "default.cfg");
5650
}

SU2_DOT/src/SU2_DOT.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
#include "../../SU2_DEF/include/drivers/CDiscAdjDeformationDriver.hpp"
2929

30-
#include <cstring>
31-
3230
int main(int argc, char* argv[]) {
3331
char config_file_name[MAX_STRING_SIZE];
3432

@@ -49,11 +47,7 @@ int main(int argc, char* argv[]) {
4947
(if no config file is specified, default.cfg is used). ---*/
5048

5149
if (argc == 2) {
52-
if (strlen(argv[1]) >= MAX_STRING_SIZE) {
53-
SU2_MPI::Error("Config file path too long (exceeds MAX_STRING_SIZE).", CURRENT_FUNCTION);
54-
}
55-
strncpy(config_file_name, argv[1], MAX_STRING_SIZE - 1);
56-
config_file_name[MAX_STRING_SIZE - 1] = '\0';
50+
strcpy(config_file_name, argv[1]);
5751
} else {
5852
strcpy(config_file_name, "default.cfg");
5953
}

SU2_GEO/src/SU2_GEO.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
*/
2727

2828
#include "../include/SU2_GEO.hpp"
29-
30-
#include <cstring>
31-
3229
using namespace std;
3330

3431
int main(int argc, char* argv[]) {
@@ -95,11 +92,7 @@ int main(int argc, char* argv[]) {
9592
file is specified, default.cfg is used) ---*/
9693

9794
if (argc == 2) {
98-
if (strlen(argv[1]) >= MAX_STRING_SIZE) {
99-
SU2_MPI::Error("Config file path too long (exceeds MAX_STRING_SIZE).", CURRENT_FUNCTION);
100-
}
101-
strncpy(config_file_name, argv[1], MAX_STRING_SIZE - 1);
102-
config_file_name[MAX_STRING_SIZE - 1] = '\0';
95+
strcpy(config_file_name, argv[1]);
10396
} else {
10497
strcpy(config_file_name, "default.cfg");
10598
}

SU2_SOL/src/SU2_SOL.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
#include "../include/SU2_SOL.hpp"
2929

30-
#include <cstring>
31-
3230
using namespace std;
3331

3432
int main(int argc, char* argv[]) {
@@ -58,11 +56,7 @@ int main(int argc, char* argv[]) {
5856
file is specified, default.cfg is used) ---*/
5957

6058
if (argc == 2 || argc == 3) {
61-
if (strlen(argv[1]) >= MAX_STRING_SIZE) {
62-
SU2_MPI::Error("Config file path too long (exceeds MAX_STRING_SIZE).", CURRENT_FUNCTION);
63-
}
64-
strncpy(config_file_name, argv[1], MAX_STRING_SIZE - 1);
65-
config_file_name[MAX_STRING_SIZE - 1] = '\0';
59+
strcpy(config_file_name, argv[1]);
6660
} else {
6761
strcpy(config_file_name, "default.cfg");
6862
}
@@ -104,12 +98,7 @@ int main(int argc, char* argv[]) {
10498
read and stored. ---*/
10599

106100
if (driver_config->GetnConfigFiles() > 0) {
107-
const auto& zone_filename = driver_config->GetConfigFilename(iZone);
108-
if (zone_filename.size() >= MAX_STRING_SIZE) {
109-
SU2_MPI::Error("Zone config file path too long (exceeds MAX_STRING_SIZE).", CURRENT_FUNCTION);
110-
}
111-
strncpy(zone_file_name, zone_filename.c_str(), MAX_STRING_SIZE - 1);
112-
zone_file_name[MAX_STRING_SIZE - 1] = '\0';
101+
strcpy(zone_file_name, driver_config->GetConfigFilename(iZone).c_str());
113102
config_container[iZone] = new CConfig(driver_config, zone_file_name, SU2_COMPONENT::SU2_SOL, iZone, nZone, true);
114103
} else {
115104
config_container[iZone] =

0 commit comments

Comments
 (0)