AgentMarketMCP / SKILL 资产档案馆

目录 / C

SKILL 未评级 已上架

C

--- name: C slug: c version: 1.0.1 description: Write safe C avoiding memory corruption, buffer overflows, and undefined behavior traps. metadata: {"clawdbot":{"emoji":"⚙️","requires":{"bins":["gcc","clang"]},"os":["linux","darwin","win32"]}} --- ## Quick Reference | Topic | File | |-------|------| | malloc/free, leaks, double free | `memory.md` | | Null, dangling, pointer arithmetic | `pointers.md` | | Null terminator, buffer overflow | `strings.md` | | Integer overflow, signed/unsigned | `types.md` | | Macro traps, include guards | `preprocessor.md` | | Common undefined behavior | `undefined.md` | ## Critical Rules - `malloc` returns `void*` — cast required in C++, optional in C but check for NULL - `free(ptr); ptr = NULL;` — always null after free to prevent double-free - `sizeof(array)` in function gives pointer size, not array size — pass length separately - `char str[5] = "hello";` — no room for null terminator, UB when used as string - `strcpy` doesn't check bounds — use `strncpy` and manually null-terminate - Signed overflow is UB — compiler can optimize assuming it never happens - `i++ + i++` is UB — no sequence point between modifications - Returning pointer to local variable — dangling pointer, UB on use - `#define SQUARE(x) x*x` — `SQUARE(1+2)` = `1+2*1+2` = 5, not 9 - `memcpy` with overlapping regions — use `memmove` instead - Uninitialized variables — contain garbage, UB if used - Array out of bounds — no runtime check, silent corruption or crash

模型生成摘要(rules/v1 · 2026-10-01 11:05):---
这是模型对公开材料的总结,不是官方声明,请以原链内容为准。

存档时间线

版本存档时间内容哈希内容
v52026-09-28 17:52bd1807d1 已过保留期
v62026-09-29 02:32e6de2314 已过保留期
v72026-09-28 21:28bd1807d1 已过保留期
v82026-09-29 12:07e6de2314 已过保留期
v92026-09-29 16:22bd1807d1 已过保留期
v102026-09-30 04:11e6de2314 已过保留期
v112026-09-30 11:27bd1807d1 已过保留期
v122026-09-30 23:34e6de2314 已过保留期
v132026-10-01 06:32bd1807d1 已过保留期
v142026-10-01 18:15e6de2314 可取

版本索引永久保留;内容副本只保留最新 1 份,更早版本仅留索引与哈希(存档时间线的证据链不会因此断裂)。

下载存档内容副本

纠错与举报(发现条目失效、署名有误或涉及侵权?)
提交举报 / 纠错

侵权举报经核验成立后,我们会即时下线该条目并删除已存的内容副本。