Fix: sessiond: fix possible buffer overflow warning
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 10 Nov 2021 13:39:22 +0000 (08:39 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 17 Dec 2021 04:45:49 +0000 (23:45 -0500)
commit05bd642d3bda3ac75f1b5ea1dd951f298763642f
tree9ebe441d86b86e41373f5ace441085514c955d78
parentfef43092d18c36920706df297224b619662efbd7
Fix: sessiond: fix possible buffer overflow warning

When compiling with clang-14 on Ubuntu 20.04, I get:

      CC       lttng-syscall.lo
    /home/smarchi/src/lttng-tools/src/bin/lttng-sessiond/lttng-syscall.c:70:13: error: 'fscanf' may overflow; destination buffer in argument 4 has size 255, but the corresponding specifier may require size 256 [-Werror,-Wfortify-source]
                                    &index, name, &bitness) == 3) {
                                            ^

I think the compiler is right, we read a string when length up to 255 in
a buffer of size 255.  We need one more byte for the NULL terminator,
fix that.

Change-Id: I6b2eec401af3ef6230dd4b6c8559032de9b54584
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/lttng-syscall.c
This page took 0.026416 seconds and 5 git commands to generate.