瀏覽代碼

Fix buffer overflow in strcmp test

Signed-off-by: Ben Kimock <kimockb@gmail.com>
Ben Kimock 2 年之前
父節點
當前提交
14bdb38a8d
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/helpers.rs

+ 2 - 2
src/helpers.rs

@@ -203,8 +203,8 @@ pub fn sqrti (arg1: u64, unused2: u64, unused3: u64, unused4: u64, unused5: u64)
 /// ```
 /// use rbpf::helpers;
 ///
-/// let foo = "This is a string.".as_ptr() as u64;
-/// let bar = "This is another sting.".as_ptr() as u64;
+/// let foo = "This is a string.\0".as_ptr() as u64;
+/// let bar = "This is another sting.\0".as_ptr() as u64;
 ///
 /// assert!(helpers::strcmp(foo, foo, 0, 0, 0) == 0);
 /// assert!(helpers::strcmp(foo, bar, 0, 0, 0) != 0);