From: Adrian Reber <adrian@lisas.de>
To: linux-kernel@vger.kernel.org
Subject: vsnprintf patch
Date: Wed, 13 Aug 2003 13:52:12 +0200 [thread overview]
Message-ID: <20030813115212.GA28066@lisas.de> (raw)
When using the snprintf function from the kernel the length returned is
not the length written:
len = snprintf(test,1,"BLA 1");
len is 5 although test is "B"
the patch below fixes the symptom, but I am not sure if this is the real
solution for this problem.
--- linux-2.6.0-test3.orig/lib/vsprintf.c 2003-08-09 06:40:52.000000000 +0200
+++ linux-2.6.0-test3/lib/vsprintf.c 2003-08-13 13:41:15.000000000 +0200
@@ -455,7 +455,10 @@
/* the trailing null byte doesn't count towards the total
* ++str;
*/
- return str-buf;
+ if (str-buf > size)
+ return size;
+ else
+ return str-buf;
}
/**
Adrian
next reply other threads:[~2003-08-13 11:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-13 11:52 Adrian Reber [this message]
2003-08-13 12:16 ` vsnprintf patch Andreas Schwab
2003-08-13 12:19 ` viro
2003-08-13 12:21 ` Bernd Petrovitsch
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=20030813115212.GA28066@lisas.de \
--to=adrian@lisas.de \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox