From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] lib: fix offset in tst_resm_hexd
Date: Fri, 13 Jan 2017 10:45:13 +0100 [thread overview]
Message-ID: <fa1847cc72ff0178bd6744a1822077674059af28.1484300599.git.jstancek@redhat.com> (raw)
Commit f72ca5b9c484 "lib: add tst_res_hexd for newlib"
broke tst_resm_hexd when I moved "offset = strlen(tmesg)"
before macro that expands varargs.
Fix it by moving offset initialisation after EXPAND_VAR_ARGS.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
lib/tst_res.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/tst_res.c b/lib/tst_res.c
index 261dec0fbba8..61daaeb4944e 100644
--- a/lib/tst_res.c
+++ b/lib/tst_res.c
@@ -509,7 +509,7 @@ void tst_resm_hexd_(const char *file, const int lineno, int ttype,
char tmesg[USERMESG];
static const size_t symb_num = 2; /* xx */
static const size_t size_max = 16;
- size_t offset = strlen(tmesg);
+ size_t offset;
size_t i;
char *pmesg = tmesg;
tst_res_func_t res_func;
@@ -520,6 +520,7 @@ void tst_resm_hexd_(const char *file, const int lineno, int ttype,
res_func = tst_res__;
EXPAND_VAR_ARGS(tmesg, arg_fmt, USERMESG);
+ offset = strlen(tmesg);
if (size > size_max || size == 0 ||
(offset + size * (symb_num + 1)) >= USERMESG)
--
1.8.3.1
next reply other threads:[~2017-01-13 9:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-13 9:45 Jan Stancek [this message]
2017-01-16 9:26 ` [LTP] [PATCH] lib: fix offset in tst_resm_hexd Cyril Hrubis
2017-01-16 13:33 ` Jan Stancek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fa1847cc72ff0178bd6744a1822077674059af28.1484300599.git.jstancek@redhat.com \
--to=jstancek@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.