From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: rpm@xenomai.org
Cc: Jan Kiszka <jan.kiszka@domain.hid>, xenomai@xenomai.org
Subject: Re: [Xenomai-core] [PATCH] rework xnintr_query
Date: Tue, 19 Aug 2008 11:06:47 +0200 [thread overview]
Message-ID: <48AA8D27.8020103@domain.hid> (raw)
In-Reply-To: <48AA8BCD.6050508@domain.hid>
Philippe Gerum wrote:
>> - head = snprintf(name, XNOBJECT_NAME_LEN, "IRQ%d: ", irq);
>> - name += head;
>> - strncpy(name, intr->name, XNOBJECT_NAME_LEN-head);
>> + head = snprintf(name_buf, XNOBJECT_NAME_LEN, "IRQ%d: ", irq);
>> + strncpy(name_buf + head, intr->name, XNOBJECT_NAME_LEN-head);
>
> - strncpy(name_buf + head, intr->name, XNOBJECT_NAME_LEN-head);
> + strncpy(name_buf + head, intr->name, XNOBJECT_NAME_LEN-1-head);
> + name_buf[XNOBJECT_NAME_LEN-1] = '\0';
>
> Object names should always be null-terminated.
Yes, and what is the point of not doing everything with only one
snprintf ? strncpy uselessly burns CPU cycles by filling the destination
buffers with zeros if source is smaller than destination.
--
Gilles.
next prev parent reply other threads:[~2008-08-19 9:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-04 7:02 [Xenomai-core] [PATCH] Buffer over flow in /proc/xenomai/stat Atsushi Katagiri
2008-08-04 7:49 ` Philippe Gerum
2008-08-04 9:38 ` Atsushi Katagiri
2008-08-04 10:15 ` Philippe Gerum
2008-08-04 10:22 ` Philippe Gerum
2008-08-04 11:42 ` Atsushi Katagiri
2008-08-13 10:53 ` Jan Kiszka
2008-08-13 13:06 ` Philippe Gerum
2008-08-18 19:11 ` [Xenomai-core] [PATCH] rework xnintr_query (was: [PATCH] Buffer over flow in /proc/xenomai/stat) Jan Kiszka
2008-08-19 9:01 ` [Xenomai-core] [PATCH] rework xnintr_query Philippe Gerum
2008-08-19 9:06 ` Gilles Chanteperdrix [this message]
2008-08-19 19:31 ` Jan Kiszka
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=48AA8D27.8020103@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=jan.kiszka@domain.hid \
--cc=rpm@xenomai.org \
--cc=xenomai@xenomai.org \
/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.