diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2008-02-02 17:25:40 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2008-02-02 17:25:40 +0000 |
commit | 677eb18d202d100871dd6b08a18db9dba314ed3b (patch) | |
tree | be5bef5296434902f49f006f350c91544fdda44d /epan/dissectors/packet-bthci_cmd.c | |
parent | f4871e6269b60873a2a82db5f8c88ef8228d9c1b (diff) |
Rewrote some prohibited APIs in epan/dissectors/ (sprintf, strcpy, strcat).
If we get some truncated strings we probably overwrote some buffers...
svn path=/trunk/; revision=24249
Diffstat (limited to 'epan/dissectors/packet-bthci_cmd.c')
-rw-r--r-- | epan/dissectors/packet-bthci_cmd.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c index a393c924e3..4f0c2bf83e 100644 --- a/epan/dissectors/packet-bthci_cmd.c +++ b/epan/dissectors/packet-bthci_cmd.c @@ -834,20 +834,20 @@ dissect_bthci_cmd_cod(int type, tvbuff_t *tvb, int offset, packet_info *pinfo _U buf[0] = '\0'; proto_item_append_text(item, " (%s - services:", val_to_str(cod1 & 0x1f, bthci_cmd_major_dev_class_vals, "???")); - if (cod2 & 0x80) strcat(buf, " Information,"); - if (cod2 & 0x40) strcat(buf, " Telephony,"); - if (cod2 & 0x20) strcat(buf, " Audio,"); - if (cod2 & 0x10) strcat(buf, " Object transfer,"); - if (cod2 & 0x08) strcat(buf, " Capturing,"); - if (cod2 & 0x04) strcat(buf, " Rendering,"); - if (cod2 & 0x02) strcat(buf, " Networking,"); - if (cod2 & 0x01) strcat(buf, " Positioning,"); - if (cod1 & 0x20) strcat(buf, " Limited discoverable mode,"); + if (cod2 & 0x80) strncat(buf, " Information,", sizeof(buf) - strlen(buf)); + if (cod2 & 0x40) strncat(buf, " Telephony,", sizeof(buf) - strlen(buf)); + if (cod2 & 0x20) strncat(buf, " Audio,", sizeof(buf) - strlen(buf)); + if (cod2 & 0x10) strncat(buf, " Object transfer,", sizeof(buf) - strlen(buf)); + if (cod2 & 0x08) strncat(buf, " Capturing,", sizeof(buf) - strlen(buf)); + if (cod2 & 0x04) strncat(buf, " Rendering,", sizeof(buf) - strlen(buf)); + if (cod2 & 0x02) strncat(buf, " Networking,", sizeof(buf) - strlen(buf)); + if (cod2 & 0x01) strncat(buf, " Positioning,", sizeof(buf) - strlen(buf)); + if (cod1 & 0x20) strncat(buf, " Limited discoverable mode,", sizeof(buf) - strlen(buf)); buf[strlen(buf)-1] = '\0'; /* skip last comma */ - strcat(buf, ")"); - + strncat(buf, ")", sizeof(buf) - strlen(buf)); + buf[128-1] = '\0'; proto_item_append_text(item, buf); } else |