Skip to content

Commit

Permalink
Fix bad length in snprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala committed Dec 16, 2024
1 parent db5f887 commit 2a5f5c8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
matrix:
os: [ubuntu-22.04, ubuntu-latest]
build_system: ["autotools", "cmake"]
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.10"]
hdf5-branch: ["hdf5_1_14", "develop"]
compiler: ["gcc-11", "gcc-12", "gcc-13"]
exclude:
Expand Down
2 changes: 1 addition & 1 deletion build_vol_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ rm -f "${BUILD_DIR}/CMakeCache.txt"

cd "${BUILD_DIR}"

CFLAGS="-D_POSIX_C_SOURCE=200809L -g -O0" cmake -G "-DCMAKE_C_COMPILER=gcc-12" "${CMAKE_GENERATOR}" "-DHDF5_ROOT=${HDF5_INSTALL_DIR}" -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" "${CURL_OPT}" "${YAJL_OPT}" "${YAJL_LIB_OPT}" "${CONNECTOR_DEBUG_OPT}" "${CURL_DEBUG_OPT}" "${MEM_TRACK_OPT}" "${THREAD_SAFE_OPT}" "${SCRIPT_DIR}"
CFLAGS="-D_POSIX_C_SOURCE=200809L" cmake -G "${CMAKE_GENERATOR}" "-DHDF5_ROOT=${HDF5_INSTALL_DIR}" -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" "${CURL_OPT}" "${YAJL_OPT}" "${YAJL_LIB_OPT}" "${CONNECTOR_DEBUG_OPT}" "${CURL_DEBUG_OPT}" "${MEM_TRACK_OPT}" "${THREAD_SAFE_OPT}" "${SCRIPT_DIR}"

echo "Build files have been generated for CMake generator '${CMAKE_GENERATOR}'"

Expand Down
7 changes: 3 additions & 4 deletions src/rest_vol.c
Original file line number Diff line number Diff line change
Expand Up @@ -3164,10 +3164,9 @@ RV_convert_dataspace_shape_to_JSON(hid_t space_id, char **shape_body, char **max
strcat(maxdims_out_string_curr_pos++, "0");
} /* end if */
else {
if ((bytes_printed =
snprintf(maxdims_out_string_curr_pos,
maxdims_out_string_new_len - (size_t)maxdims_out_string_curr_pos,
"%s%" PRIuHSIZE, i > 0 ? "," : "", maxdims[i])) < 0)
if ((bytes_printed = snprintf(maxdims_out_string_curr_pos,
maxdims_out_string_new_len - (size_t)buf_ptrdiff,
"%s%" PRIuHSIZE, i > 0 ? "," : "", maxdims[i])) < 0)
FUNC_GOTO_ERROR(H5E_DATASPACE, H5E_SYSERRSTR, FAIL, "snprintf error");
maxdims_out_string_curr_pos += bytes_printed;
} /* end else */
Expand Down
16 changes: 5 additions & 11 deletions src/rest_vol_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
/* Define to 1 if you have the <mach/mach_time.h> header file. */
#undef HAVE_MACH_MACH_TIME_H

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the <setjmp.h> header file. */
#undef HAVE_SETJMP_H

Expand All @@ -45,9 +48,6 @@
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

Expand Down Expand Up @@ -81,9 +81,6 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Whether HDF5 version is at least 2.0.0 */
#undef HDF5_2

/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR

Expand Down Expand Up @@ -114,13 +111,10 @@
/* The size of `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T

/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. This
macro is obsolete. */
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME

/* Define to have the REST VOL track memory usage. */
Expand Down

0 comments on commit 2a5f5c8

Please sign in to comment.