logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

1001-Prevent-zero-sized-arrays.patch (2388B)


  1. From a9a8b003bc97952fcc47d84b2ba9c490d90985e3 Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Fri, 18 Feb 2022 01:40:22 -0800
  4. Subject: [PATCH] Prevent zero-sized arrays
  5. ---
  6. src/xlat/btrfs_features_compat.h | 3 ++-
  7. src/xlat/compat_ptrace_cmds.h | 3 ++-
  8. src/xlat/sigprof_codes.h | 3 ++-
  9. 3 files changed, 6 insertions(+), 3 deletions(-)
  10. diff --git a/src/xlat/btrfs_features_compat.h b/src/xlat/btrfs_features_compat.h
  11. index 12136c495..cc5804a1b 100644
  12. --- a/src/xlat/btrfs_features_compat.h
  13. +++ b/src/xlat/btrfs_features_compat.h
  14. @@ -15,13 +15,14 @@ extern const struct xlat btrfs_features_compat[];
  15. DIAG_PUSH_IGNORE_TAUTOLOGICAL_CONSTANT_COMPARE
  16. static const struct xlat_data btrfs_features_compat_xdata[] = {
  17. + {0}
  18. };
  19. # if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
  20. static
  21. # endif
  22. const struct xlat btrfs_features_compat[1] = { {
  23. .data = btrfs_features_compat_xdata,
  24. - .size = ARRAY_SIZE(btrfs_features_compat_xdata),
  25. + .size = ARRAY_SIZE(btrfs_features_compat_xdata) - 1,
  26. .type = XT_NORMAL,
  27. .flags_mask = 0
  28. ,
  29. diff --git a/src/xlat/compat_ptrace_cmds.h b/src/xlat/compat_ptrace_cmds.h
  30. index 9a7fc96b1..a29567689 100644
  31. --- a/src/xlat/compat_ptrace_cmds.h
  32. +++ b/src/xlat/compat_ptrace_cmds.h
  33. @@ -225,11 +225,12 @@ static const struct xlat_data compat_ptrace_cmds_xdata[] = {
  34. #define XLAT_VAL_9 ((unsigned) (COMPAT_PTRACE_SETHBPREGS))
  35. #define XLAT_STR_9 STRINGIFY(COMPAT_PTRACE_SETHBPREGS)
  36. #endif
  37. + {0}
  38. };
  39. static
  40. const struct xlat compat_ptrace_cmds[1] = { {
  41. .data = compat_ptrace_cmds_xdata,
  42. - .size = ARRAY_SIZE(compat_ptrace_cmds_xdata),
  43. + .size = ARRAY_SIZE(compat_ptrace_cmds_xdata) - 1,
  44. .type = XT_SORTED,
  45. .flags_mask = 0
  46. # ifdef XLAT_VAL_0
  47. diff --git a/src/xlat/sigprof_codes.h b/src/xlat/sigprof_codes.h
  48. index bc61fdc8f..88f043ab9 100644
  49. --- a/src/xlat/sigprof_codes.h
  50. +++ b/src/xlat/sigprof_codes.h
  51. @@ -20,13 +20,14 @@ static const struct xlat_data sigprof_codes_xdata[] = {
  52. #define XLAT_VAL_0 ((unsigned) (PROF_SIG))
  53. #define XLAT_STR_0 STRINGIFY(PROF_SIG)
  54. #endif
  55. + {0}
  56. };
  57. # if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
  58. static
  59. # endif
  60. const struct xlat sigprof_codes[1] = { {
  61. .data = sigprof_codes_xdata,
  62. - .size = ARRAY_SIZE(sigprof_codes_xdata),
  63. + .size = ARRAY_SIZE(sigprof_codes_xdata) - 1,
  64. .type = XT_NORMAL,
  65. .flags_mask = 0
  66. # ifdef XLAT_VAL_0
  67. --
  68. 2.34.1