pmqtest: Increase buffer to avoid overflow

Increase the size of the char buffer. gcc 9.1.1 reports:

src/pmqtest/pmqtest.c: In function ‘main’:
src/pmqtest/pmqtest.c:46:21: warning: ‘%d’ directive writing between 1 and 10 bytes into a region of size 8 [-Wformat-overflow=]
   46 | #define SYNCMQ_NAME "/syncmsg%d"
      |                     ^~~~~~~~~~~~

src/pmqtest/pmqtest.c:445:3: note: ‘sprintf’ output between 10 and 19 bytes into a destination of size 16
  445 |   sprintf(mqname, SYNCMQ_NAME, i);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Daniel Wagner <wagi@monom.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
This commit is contained in:
Daniel Wagner 2019-08-19 08:43:01 +02:00 committed by John Kacur
parent 08d456085a
commit 34eb77accd
1 changed files with 2 additions and 2 deletions

View File

@ -440,7 +440,7 @@ int main(int argc, char *argv[])
goto nomem;
for (i = 0; i < num_threads; i++) {
char mqname[16];
char mqname[19];
sprintf(mqname, SYNCMQ_NAME, i);
receiver[i].syncmq = mq_open(mqname, oflag, 0777, &mqstat);
@ -567,7 +567,7 @@ int main(int argc, char *argv[])
}
nanosleep(&maindelay, NULL);
for (i = 0; i < num_threads; i++) {
char mqname[16];
char mqname[19];
mq_close(receiver[i].syncmq);
sprintf(mqname, SYNCMQ_NAME, i);