Skip to content

Commit 5259373

Browse files
committed
Fix bug caused by incorrect sscanf usage in test_pdalc_pipeline
1 parent b841555 commit 5259373

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

tests/pdal/test_pdalc_pipeline.c.in

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
*****************************************************************************/
3030

3131
// Required before including stdio.h to support secure scanf C functions
32+
#if defined(__STDC_LIB_EXT1__)
3233
#define __STDC_WANT_LIB_EXT1__ 1
34+
#endif
3335

3436
#include <stdio.h>
3537
#include <assert.h>
@@ -91,7 +93,11 @@ TEST testPDALGetPipelineAsString(void)
9193

9294
// Make sure that the JSON object's name is "pipeline"
9395
char jsonName[16];
94-
sscanf_s(json, "%*s\n\t%10s", &jsonName, 16);
96+
#if defined(__STDC_LIB_EXT1__)
97+
sscanf_s(json, "%*s\n\t%10s", jsonName, 16);
98+
#else
99+
sscanf(json, "%*s\n\t%10s", jsonName);
100+
#endif
95101
ASSERT_STR_EQ("\"pipeline\"", jsonName);
96102

97103
PDALDisposePipeline(pipeline);
@@ -113,7 +119,11 @@ TEST testPDALGetPipelineMetadata(void)
113119

114120
// Make sure that the JSON object's name is "metadata"
115121
char jsonName[16];
116-
sscanf_s(json, "%*s\n\t%10s", &jsonName, 16);
122+
#if defined(__STDC_LIB_EXT1__)
123+
sscanf_s(json, "%*s\n\t%10s", jsonName, 16);
124+
#else
125+
sscanf(json, "%*s\n\t%10s", jsonName);
126+
#endif
117127
ASSERT_STR_EQ("\"metadata\"", jsonName);
118128

119129
PDALDisposePipeline(pipeline);
@@ -135,7 +145,11 @@ TEST testPDALGetPipelineSchema(void)
135145

136146
// Make sure that the JSON object's name is "schema"
137147
char jsonName[16];
138-
sscanf_s(json, "%*s\n\t%8s", &jsonName, 16);
148+
#if defined(__STDC_LIB_EXT1__)
149+
sscanf_s(json, "%*s\n\t%10s", jsonName, 16);
150+
#else
151+
sscanf(json, "%*s\n\t%10s", jsonName);
152+
#endif
139153
ASSERT_STR_EQ("\"schema\"", jsonName);
140154

141155
PDALDisposePipeline(pipeline);

0 commit comments

Comments
 (0)