s3:torture: Fix possible array out of bounds access
commitb5e9c2bc0ed5d24aa994a3f278e31aba4d4f58a6
authorAndreas Schneider <asn@samba.org>
Thu, 20 Apr 2023 11:29:27 +0000 (20 13:29 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 27 Apr 2023 07:21:33 +0000 (27 07:21 +0000)
tree5d43084ab17fd979aa89737e24f012b16ed82fe1
parent732efb3d9629ba0af602066f134e6519efadcef5
s3:torture: Fix possible array out of bounds access

In function ‘test_one’,
    inlined from ‘retest’ at source3/torture/locktest2.c:401:8:
source3/torture/locktest2.c:331:37: error: array subscript 2 is above array bounds of ‘int[2][2][2]’ [-Werror=array-bounds=]
  331 |                         fnum[server][fstype][conn][f] = try_open(cli[server][conn], nfs[server], fstype, FILENAME,
      |                         ~~~~~~~~~~~~^~~~~~~~
source3/torture/locktest2.c: In function ‘retest’:
source3/torture/locktest2.c:390:23: note: while referencing ‘fnum’
  390 |                   int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
      |                   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘test_one’,
    inlined from ‘retest’ at source3/torture/locktest2.c:401:8:
source3/torture/locktest2.c:316:62: error: array subscript 2 is above array bounds of ‘int[2][2][2]’ [-Werror=array-bounds=]
  316 |                                                  fnum[server][fstype][conn][f],
      |                                                  ~~~~~~~~~~~~^~~~~~~~
source3/torture/locktest2.c: In function ‘retest’:
source3/torture/locktest2.c:390:23: note: while referencing ‘fnum’
  390 |                   int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
      |                   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘test_one’,
    inlined from ‘retest’ at source3/torture/locktest2.c:401:8:
source3/torture/locktest2.c:300:60: error: array subscript 2 is above array bounds of ‘int[2][2][2]’ [-Werror=array-bounds=]
  300 |                                                fnum[server][fstype][conn][f],
      |                                                ~~~~~~~~~~~~^~~~~~~~
source3/torture/locktest2.c: In function ‘retest’:
source3/torture/locktest2.c:390:23: note: while referencing ‘fnum’
  390 |                   int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
      |                   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/torture/locktest2.c