看板 FB_bugs 關於我們 聯絡資訊
Synopsis: Use of sizeof in dhclinet.c. State-Changed-From-To: open->closed State-Changed-By: brian State-Changed-When: Fri Jun 12 09:43:16 UTC 2009 State-Changed-Why: The suggested patch is not correct. The options variable is an array of 256 tree_cache pointers and the code wants to set all pointers to NULL. The proposed change would just set the first pointer to NULL. To demonstrate: #include <stdio.h> #include <string.h> struct tree_cache { int x; int y; }; int main() { struct tree_cache *options[256]; int f; for (f = 0; f < 256; f++) options[f] = (struct tree_cache *)123; printf("Zeroing %u bytes\n", sizeof options); memset(options, 0, sizeof options); for (f = 0; f < 256; f++) if (options[f] != NULL) printf("Oops, %d is wrong\n", f); return 0; } http://www.freebsd.org/cgi/query-pr.cgi?pr=135494 _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"