public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug tapsets/15617] New: user_string_n_quoted() does not truncate properly
@ 2013-06-13 18:26 jlebon at redhat dot com
  2013-06-13 18:27 ` [Bug tapsets/15617] " jlebon at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: jlebon at redhat dot com @ 2013-06-13 18:26 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=15617

            Bug ID: 15617
           Summary: user_string_n_quoted() does not truncate properly
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tapsets
          Assignee: systemtap at sourceware dot org
          Reporter: jlebon at redhat dot com

The length of the string returned by user_string_n_quoted() is one longer than
dictated by n. For example:

stap -e 'probe nd_syscall.write { if (pid() == target()) { printf("%s\n",
user_string_n_quoted(buf_uaddr, 15)); exit()}}' -c 'echo this_is_a_test >
/dev/null'

Prints out

"this_is_a_t"...

which is 16 characters long, not 15.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug tapsets/15617] user_string_n_quoted() does not truncate properly
  2013-06-13 18:26 [Bug tapsets/15617] New: user_string_n_quoted() does not truncate properly jlebon at redhat dot com
@ 2013-06-13 18:27 ` jlebon at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: jlebon at redhat dot com @ 2013-06-13 18:27 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=15617

Jonathan Lebon <jlebon at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Jonathan Lebon <jlebon at redhat dot com> ---
Fixed in this commit:
http://sourceware.org/git/gitweb.cgi?p=systemtap.git;a=commitdiff;h=d03bc68e1f7050ba5dfeabbe3e40c43b24f1f283

The 'len' parameter passed to _stp_text_str() was incorrectly set to 1 higher
than need be. The function _stp_text_str() does not count the trailing NULL. In
contrast, the function _stp_strncpy_from_user() does, which is also used in
this tapset, in which case 'len' should indeed be incremented (see e.g.
user_string_n()). This may have been the source of the confusion.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-13 18:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-13 18:26 [Bug tapsets/15617] New: user_string_n_quoted() does not truncate properly jlebon at redhat dot com
2013-06-13 18:27 ` [Bug tapsets/15617] " jlebon at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).