aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-10-27 08:50:42 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-10-27 08:50:42 +0000
commit9696d9dae8781da20edd3e8e6d592c42dc66c4da (patch)
tree32f7056cb1f974ff02198e634de9751714194a98
parent494958fbad9ee8bfc63fe31afcfa2f6d62af359c (diff)
remove a strcpy
make the code A LOT nicer and get rid of unchecked memcpy svn path=/trunk/; revision=16332
-rw-r--r--epan/dissectors/packet-ldap.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c
index 60430258e8..307dc5e281 100644
--- a/epan/dissectors/packet-ldap.c
+++ b/epan/dissectors/packet-ldap.c
@@ -661,19 +661,9 @@ static int parse_filter_strings(ASN1_SCK *a, char **filter, guint *filter_length
*filter_length += 2 + strlen(operation) + string_length + string2_length;
*filter = g_realloc(*filter, *filter_length);
filterp = *filter + strlen(*filter);
- *filterp++ = '(';
- if (string_length != 0) {
- memcpy(filterp, string, string_length);
- filterp += string_length;
- }
- strcpy(filterp, operation);
- filterp += strlen(operation);
- if (string2_length != 0) {
- memcpy(filterp, string2, string2_length);
- filterp += string2_length;
- }
- *filterp++ = ')';
- *filterp = '\0';
+
+ filterp += g_snprintf(filterp, (*filter_length)-(filterp-*filter), "(%s%s%s)", string, operation, string2);
+
g_free(string);
g_free(string2);
return ASN1_ERR_NOERROR;