Skip to content

Commit

Permalink
local: Increase temp buffer size for pathname resolution
Browse files Browse the repository at this point in the history
Fixes these issues:

../local.c: In function ‘add_scan_elements’:
../local.c:1701:38: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 0 and 1023 [-Wformat-truncation=]
 1701 |   iio_snprintf(buf, sizeof(buf), "%s/%s", path, entry->d_name);
      |                                      ^~
In file included from ../local.c:10:
../iio-private.h:38:22: note: ‘snprintf’ output between 2 and 1280 bytes into a destination of size 1024
   38 | #define iio_snprintf snprintf
../local.c:1701:3: note: in expansion of macro ‘iio_snprintf’
 1701 |   iio_snprintf(buf, sizeof(buf), "%s/%s", path, entry->d_name);
      |   ^~~~~~~~~~~~
../local.c: In function ‘add_buffer_attributes’:
../local.c:1701:38: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 0 and 1023 [-Wformat-truncation=]
 1701 |   iio_snprintf(buf, sizeof(buf), "%s/%s", path, entry->d_name);
      |                                      ^~
In file included from ../local.c:10:
../iio-private.h:38:22: note: ‘snprintf’ output between 2 and 1280 bytes into a destination of size 1024
   38 | #define iio_snprintf snprintf
../local.c:1701:3: note: in expansion of macro ‘iio_snprintf’
 1701 |   iio_snprintf(buf, sizeof(buf), "%s/%s", path, entry->d_name);
      |   ^~~~~~~~~~~~
../local.c: In function ‘local_create_context’:
../local.c:1701:38: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 0 and 1023 [-Wformat-truncation=]
 1701 |   iio_snprintf(buf, sizeof(buf), "%s/%s", path, entry->d_name);
      |                                      ^~
In file included from ../local.c:10:
../iio-private.h:38:22: note: ‘snprintf’ output between 2 and 1280 bytes into a destination of size 1024
   38 | #define iio_snprintf snprintf
../local.c:1701:3: note: in expansion of macro ‘iio_snprintf’
 1701 |   iio_snprintf(buf, sizeof(buf), "%s/%s", path, entry->d_name);
      |   ^~~~~~~~~~~~

Signed-off-by: Paul Cercueil <[email protected]>
  • Loading branch information
pcercuei committed Apr 20, 2021
1 parent f7dccb5 commit eefe69c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion local.c
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@ static int foreach_in_dir(void *d, const char *path, bool is_dir,

while (true) {
struct stat st;
char buf[1024];
char buf[PATH_MAX];

errno = 0;
entry = readdir(dir);
Expand Down

0 comments on commit eefe69c

Please sign in to comment.