[PATCH 2/7] os: silently ignore length modifiers in pnprintf

Peter Hutterer peter.hutterer at who-t.net
Wed Jan 16 23:19:59 PST 2013


Until we have support for them, ignore any length modifiers so we don't need
to update all callers.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 os/log.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/os/log.c b/os/log.c
index 4820e9a..2139064 100644
--- a/os/log.c
+++ b/os/log.c
@@ -298,7 +298,13 @@ pnprintf(char *string, size_t size, const char *f, va_list args)
             continue;
         }
 
-        switch (f[++f_idx]) {
+        f_idx++;
+
+        /* silently swallow length modifiers */
+        while (f_idx < f_len && ((f[f_idx] >= '0' && f[f_idx] <= '9') || f[f_idx] == '.'))
+            f_idx++;
+
+        switch (f[f_idx]) {
         case 's':
             string_arg = va_arg(args, char*);
             p_len = strlen_sigsafe(string_arg);
-- 
1.8.1



More information about the xorg-devel mailing list