lkml.org 
[lkml]   [2003]   [Aug]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectvsnprintf patch

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.085 / U:6.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site