Rewrote to avoid prohibited API strcpy.

svn path=/trunk/; revision=26006
This commit is contained in:
Stig Bjørlykke 2008-08-13 15:23:15 +00:00
parent 39515048dc
commit 675db70a1b
1 changed files with 5 additions and 9 deletions

View File

@ -2273,8 +2273,7 @@ dissect_tcpopt_scps(const ip_tcp_opt *optp, tvbuff_t *tvb,
proto_item *tf; proto_item *tf;
gchar flags[64] = "<None>"; gchar flags[64] = "<None>";
gchar *fstr[] = {"BETS", "SNACK1", "SNACK2", "COMP", "NLTS", "RESV1", "RESV2", "RESV3" }; gchar *fstr[] = {"BETS", "SNACK1", "SNACK2", "COMP", "NLTS", "RESV1", "RESV2", "RESV3" };
gchar fstrlen[] = { 4, 6, 6, 4, 4, 5, 5, 5 }; gint i, bpos;
gint fpos = 0, i, bpos;
guint8 capvector; guint8 capvector;
guint8 connid; guint8 connid;
@ -2299,22 +2298,19 @@ dissect_tcpopt_scps(const ip_tcp_opt *optp, tvbuff_t *tvb,
*/ */
if (optlen == 4) { if (optlen == 4) {
capvector = tvb_get_guint8(tvb, offset + 2); capvector = tvb_get_guint8(tvb, offset + 2);
flags[0] = '\0';
/* Decode the capabilities vector for display */ /* Decode the capabilities vector for display */
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
bpos = 128 >> i; bpos = 128 >> i;
if (capvector & bpos) { if (capvector & bpos) {
if (fpos) { if (flags[0]) {
strcpy(&flags[fpos], ", "); g_strlcat(flags, ", ", 64);
fpos += 2;
} }
strcpy(&flags[fpos], fstr[i]); g_strlcat(flags, fstr[i], 64);
fpos += fstrlen[i];
} }
} }
flags[fpos] = '\0';
/* If lossless header compression is offered, there will be a /* If lossless header compression is offered, there will be a
* single octet connectionId following the capabilities vector * single octet connectionId following the capabilities vector
*/ */