[Openmp-commits] [PATCH] D105931: [OpenMP] Fix incorrect parameters to sscanf_s call

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Aug 16 08:02:34 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG6eeb4c1f3203: [OpenMP] Fix incorrect parameters to sscanf_s call (authored by jlpeyton).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105931/new/

https://reviews.llvm.org/D105931

Files:
  openmp/runtime/src/kmp_settings.cpp


Index: openmp/runtime/src/kmp_settings.cpp
===================================================================
--- openmp/runtime/src/kmp_settings.cpp
+++ openmp/runtime/src/kmp_settings.cpp
@@ -164,7 +164,12 @@
     return (INT_MAX);
   value = (double)0.0;
   mult = '\0';
+#if KMP_OS_WINDOWS
+  // On Windows, each %c parameter needs additional size parameter for sscanf_s
+  nvalues = KMP_SSCANF(data, "%lf%c%c", &value, &mult, 1, &extra, 1);
+#else
   nvalues = KMP_SSCANF(data, "%lf%c%c", &value, &mult, &extra);
+#endif
   if (nvalues < 1)
     return (-1);
   if (nvalues == 1)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105931.366632.patch
Type: text/x-patch
Size: 586 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210816/811be324/attachment.bin>


More information about the Openmp-commits mailing list