void Database_set(struct Connection *conn, int id, const char *name, const char *email){struct Address *addr = &conn->db->rows[id];if(addr->set) die("Already set, delete it first");addr->set = 1;// WARNING: bug, read the "How To Break It" and fix thischar *res = strncpy(addr->name, name, MAX_DATA);// demonstrate the strncpy bugif(!res) die("Name copy failed");res = strncpy(addr->email, email, MAX_DATA);if(!res) die("Email copy failed");}
- 2 回答
- 0 关注
- 119 浏览
添加回答
举报
0/150
提交
取消