diff options
author | Dave Brolley <brolley@redhat.com> | 2010-02-02 08:28:16 -0500 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2010-02-02 08:28:16 -0500 |
commit | 743757687f9c09bf9ef84b576bc0aa0fc19dea4c (patch) | |
tree | be77bd3f7d03be09774a25f7260182941e99907a /tapset | |
parent | 241443ad36a5a2cacb9e8e6f12f808d304835f2a (diff) | |
parent | cc57beca8d9d168ef42edb1f8b43f594105dfdf2 (diff) | |
download | systemtap-steved-743757687f9c09bf9ef84b576bc0aa0fc19dea4c.tar.gz systemtap-steved-743757687f9c09bf9ef84b576bc0aa0fc19dea4c.tar.xz systemtap-steved-743757687f9c09bf9ef84b576bc0aa0fc19dea4c.zip |
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
Diffstat (limited to 'tapset')
-rw-r--r-- | tapset/aux_syscalls.stp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp index 4577d64e..2d0ba210 100644 --- a/tapset/aux_syscalls.stp +++ b/tapset/aux_syscalls.stp @@ -401,20 +401,20 @@ function __sem_flags:string(semflg:long) /* This function copies an argv from userspace. */ function __get_argv:string(a:long, first:long) %{ /* pure */ - char __user *__user *argv = (char __user *__user *)(long)THIS->a; + char __user *__user *argv = (char __user *__user *)(long)THIS->a; char __user *vstr; int space, rc, len = MAXSTRINGLEN; char *str = THIS->__retvalue; char buf[80]; char *ptr = buf; - + if (THIS->first && argv) argv++; - while (argv != NULL) { + while (argv != NULL && len) { if (__stp_get_user (vstr, argv)) - break; + break; if (vstr == NULL) break; @@ -443,8 +443,8 @@ function __get_argv:string(a:long, first:long) *str++='\"'; len--; } - - rc = strlcpy (str, buf, len); + + rc = min(len, (int) strlcpy (str, buf, len)); str += rc; len -= rc; @@ -455,13 +455,15 @@ function __get_argv:string(a:long, first:long) argv++; } + if (!len) + --str; *str = 0; %} /* This function copies an argv from userspace. */ function __get_compat_argv:string(a:long, first:long) %{ /* pure */ #ifdef CONFIG_COMPAT - compat_uptr_t __user *__user *argv = (compat_uptr_t __user *__user *)(long)THIS->a; + compat_uptr_t __user *__user *argv = (compat_uptr_t __user *__user *)(long)THIS->a; compat_uptr_t __user *vstr; int space, rc, len = MAXSTRINGLEN; char *str = THIS->__retvalue; @@ -471,9 +473,9 @@ function __get_compat_argv:string(a:long, first:long) if (THIS->first && argv) argv++; - while (argv != NULL) { + while (argv != NULL && len) { if (__stp_get_user (vstr, argv)) - break; + break; if (vstr == NULL) break; @@ -502,8 +504,8 @@ function __get_compat_argv:string(a:long, first:long) *str++='\"'; len--; } - - rc = strlcpy (str, buf, len); + + rc = min(len, (int) strlcpy (str, buf, len)); str += rc; len -= rc; @@ -514,6 +516,8 @@ function __get_compat_argv:string(a:long, first:long) argv++; } + if (!len) + --str; *str = 0; #endif %} @@ -1336,7 +1340,7 @@ function _sock_type_str:string(type:long) strlcpy (THIS->__retvalue, "SOCK_PACKET", MAXSTRINGLEN); break; default: - strlcpy (THIS->__retvalue, "UNKNOWN VALUE: %d", t); + snprintf (THIS->__retvalue, MAXSTRINGLEN, "UNKNOWN VALUE: %d", t); break; } |