Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167276692
D30046.id88419.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D30046.id88419.diff
View Options
Index: sbin/ipfw/ipfw2.c
===================================================================
--- sbin/ipfw/ipfw2.c
+++ sbin/ipfw/ipfw2.c
@@ -2174,32 +2174,35 @@
}
bprintf(bp, "%05u ", rule->rulenum);
- /* Print counters if enabled */
- if (fo->pcwidth > 0 || fo->bcwidth > 0) {
- pr_u64(bp, &cntr->pcnt, fo->pcwidth);
- pr_u64(bp, &cntr->bcnt, fo->bcwidth);
- }
-
- /* Print timestamp */
- if (co->do_time == TIMESTAMP_NUMERIC)
- bprintf(bp, "%10u ", cntr->timestamp);
- else if (co->do_time == TIMESTAMP_STRING) {
- char timestr[30];
- time_t t = (time_t)0;
-
- if (twidth == 0) {
- strcpy(timestr, ctime(&t));
- *strchr(timestr, '\n') = '\0';
- twidth = strlen(timestr);
+ /* only if counters are available */
+ if (cntr != NULL) {
+ /* Print counters if enabled */
+ if (fo->pcwidth > 0 || fo->bcwidth > 0) {
+ pr_u64(bp, &cntr->pcnt, fo->pcwidth);
+ pr_u64(bp, &cntr->bcnt, fo->bcwidth);
}
- if (cntr->timestamp > 0) {
- t = _long_to_time(cntr->timestamp);
- strcpy(timestr, ctime(&t));
- *strchr(timestr, '\n') = '\0';
- bprintf(bp, "%s ", timestr);
- } else {
- bprintf(bp, "%*s ", twidth, "");
+ /* Print timestamp */
+ if (co->do_time == TIMESTAMP_NUMERIC)
+ bprintf(bp, "%10u ", cntr->timestamp);
+ else if (co->do_time == TIMESTAMP_STRING) {
+ char timestr[30];
+ time_t t = (time_t)0;
+
+ if (twidth == 0) {
+ strcpy(timestr, ctime(&t));
+ *strchr(timestr, '\n') = '\0';
+ twidth = strlen(timestr);
+ }
+ if (cntr->timestamp > 0) {
+ t = _long_to_time(cntr->timestamp);
+
+ strcpy(timestr, ctime(&t));
+ *strchr(timestr, '\n') = '\0';
+ bprintf(bp, "%s ", timestr);
+ } else {
+ bprintf(bp, "%*s ", twidth, "");
+ }
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 21, 2:28 PM (11 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37036559
Default Alt Text
D30046.id88419.diff (1 KB)
Attached To
Mode
D30046: sbin/ipfw: Fix null pointer deference when printing counters
Attached
Detach File
Event Timeline
Log In to Comment