summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/ChangeLog8
-rw-r--r--runtime/loc2c-runtime.h22
-rw-r--r--runtime/vsprintf.c4
3 files changed, 30 insertions, 4 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index 497b9d5b..054def68 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,3 +1,11 @@
+2008-03-10 Dave Brolley <brolley@redhat.com>
+
+ PR5189
+ * vsprintf.c (_stp_vsnprintf): Arguments for dynamic width and precision
+ are of type 'int' again.
+ * loc2c-runtime.h (deref_string): Copy the data only if dst is not NULL.
+ (deref_buffer): New macro.
+
2008-02-27 Martin Hunt <hunt@redhat.com>
* sym.h (_stp_module): Add text_size, lock, and unwind data
diff --git a/runtime/loc2c-runtime.h b/runtime/loc2c-runtime.h
index 4674e399..7ea1b1e4 100644
--- a/runtime/loc2c-runtime.h
+++ b/runtime/loc2c-runtime.h
@@ -623,8 +623,26 @@
for (_len = (maxbytes), _addr = (uintptr_t)(addr); \
_len > 1 && (_c = deref (1, _addr)) != '\0'; \
--_len, ++_addr) \
- *_d++ = _c; \
- *_d = '\0'; \
+ if (_d) \
+ *_d++ = _c; \
+ if (_d) \
+ *_d = '\0'; \
+ (dst); \
+ })
+
+#define deref_buffer(dst, addr, numbytes) \
+ ({ \
+ uintptr_t _addr; \
+ size_t _len; \
+ unsigned char _c; \
+ char *_d = (dst); \
+ for (_len = (numbytes), _addr = (uintptr_t)(addr); \
+ _len >= 1; \
+ --_len, ++_addr) { \
+ _c = deref (1, _addr); \
+ if (_d) \
+ *_d++ = _c; \
+ } \
(dst); \
})
diff --git a/runtime/vsprintf.c b/runtime/vsprintf.c
index f8283e5c..0bf625a5 100644
--- a/runtime/vsprintf.c
+++ b/runtime/vsprintf.c
@@ -180,7 +180,7 @@ int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
else if (*fmt == '*') {
++fmt;
/* it's the next argument */
- field_width = va_arg(args, int64_t);
+ field_width = va_arg(args, int);
if (field_width < 0) {
field_width = -field_width;
flags |= STP_LEFT;
@@ -196,7 +196,7 @@ int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
else if (*fmt == '*') {
++fmt;
/* it's the next argument */
- precision = va_arg(args, int64_t);
+ precision = va_arg(args, int);
}
if (precision < 0)
precision = 0;