-
Notifications
You must be signed in to change notification settings - Fork 0
Add files via upload #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
|
|
||
| #include <stdio.h> | ||
| #include <stdlib.h> | ||
| #include <string.h> | ||
| #include <limits.h> | ||
|
|
||
| #define MAX_BUFFER 10 | ||
|
|
||
| void buffer_overflow_vuln(char* user_input) { | ||
| char buffer[MAX_BUFFER]; | ||
| strcpy(buffer, user_input); | ||
| } | ||
|
Comment on lines
+9
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify that this file is isolated from production targets and uses sanitizer-based execution.
rg -n -C 3 'c_security_test\.c|buffer_overflow_vuln|integer_overflow_vuln|fsanitize|add_executable|target_sources' .Repository: joyfaker/fock_c_json Length of output: 27213 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'Tracked files:\n'
git ls-files | rg '(^|/)c_security_test\.c$|(^|/)CMakeLists\.txt$|(^|/)src/modules/CMakeLists\.txt$|(^|/)cmake/test\.cmake$' || true
printf '\nsrc/modules/c_security_test.c:\n'
cat -n src/modules/c_security_test.c
printf '\nTop-level CMakeLists relevant sections:\n'
sed -n '1,240p' CMakeLists.txt
printf '\ncmake/test.cmake relevant sections:\n'
sed -n '1,180p' cmake/test.cmake
printf '\nCMake references containing c_security_test:\n'
rg -n --hidden -C 3 'c_security_test|security_test|EXCLUDE_FROM_ALL|add_test' .Repository: joyfaker/fock_c_json Length of output: 31845 Isolate
🧰 Tools🪛 ast-grep (0.45.0)[error] 10-10: Use of an unbounded buffer function that can overflow the destination; use a size-bounded equivalent (fgets, strncpy/strlcpy, strncat/strlcat, snprintf). (dangerous-buffer-functions-c) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
|
|
||
|
|
||
| int integer_overflow_vuln(int count, int size) { | ||
| int total_bytes = count * size; | ||
| return total_bytes; | ||
| } | ||
|
|
||
|
|
||
| int main(int argc, char* argv[]) { | ||
| buffer_overflow_vuln(argv[1]); | ||
| int result = integer_overflow_vuln(INT_MAX, 2); | ||
| return 0; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 AI 代码审查发现问题
📋 问题概述
📍 问题详情
🟡 问题 1 | 严重程度:
MEDIUM| 行号:1-10💬 详细说明:
ex_wundo和ex_rundo声明为static,但 line 8464 和 8474 处的函数定义缺少static关键字。C 语言标准规定,若函数先被声明为静态链接,后续定义也必须为静态,否则构成约束违规(constraint violation),将直接导致编译失败。📝 问题代码:
💡 修复建议:
✅ 修复示例:
🔗 参考链接
无