diff options
author | hunt <hunt> | 2006-07-12 06:14:17 +0000 |
---|---|---|
committer | hunt <hunt> | 2006-07-12 06:14:17 +0000 |
commit | cb6ac9b911f1ede63726b4f85a520b79c3d91f4c (patch) | |
tree | 5e461c0066bba54da2fed1a7e018666a1346e78e /runtime/string.c | |
parent | c4a0b9e127eafe8ac3cf3ee68c822d14c52464fa (diff) | |
download | systemtap-steved-cb6ac9b911f1ede63726b4f85a520b79c3d91f4c.tar.gz systemtap-steved-cb6ac9b911f1ede63726b4f85a520b79c3d91f4c.tar.xz systemtap-steved-cb6ac9b911f1ede63726b4f85a520b79c3d91f4c.zip |
2006-07-11 Martin Hunt <hunt@redhat.com>
* string.c (_stp_text_str): Use __get_user().
Diffstat (limited to 'runtime/string.c')
-rw-r--r-- | runtime/string.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/runtime/string.c b/runtime/string.c index 21a6c70e..740a7567 100644 --- a/runtime/string.c +++ b/runtime/string.c @@ -212,7 +212,6 @@ char * _stp_string_ptr (String str) } \ }) -#include "loc2c-runtime.h" /** Return a printable text string. * @@ -240,9 +239,12 @@ void _stp_text_str(char *outstr, char *in, int len, int quoted, int user) *out++ = '\"'; } - if (user) - c = deref(1,(char __user *)in); - else + if (user) { + if (!access_ok(VERIFY_READ, (char __user *)in, len)) + goto bad; + if (__get_user(c, (char __user *)in) < 0) + goto bad; + } else c = *in; while (c && len > 0) { @@ -307,9 +309,10 @@ void _stp_text_str(char *outstr, char *in, int len, int quoted, int user) } len -= num; in++; - if (user) - c = deref(1,(char __user *)in); - else + if (user) { + if (__get_user(c, (char __user *)in) < 0) + goto bad; + } else c = *in; } @@ -325,7 +328,7 @@ void _stp_text_str(char *outstr, char *in, int len, int quoted, int user) } *out = '\0'; return; -deref_fault: +bad: strlcpy (outstr, "<unknown>", len); } |