aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/ascend-scanner.l
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2008-05-13 19:05:35 +0000
committerAnders Broman <anders.broman@ericsson.com>2008-05-13 19:05:35 +0000
commitb48924f9d57006a3abfc94bd6bb23a668930bfe4 (patch)
treef14f6a5651efdd9e17c37dd9c1f5453e5dbc124d /wiretap/ascend-scanner.l
parentbf75c5fed27bb812a5309cc9ad04d85a28d69dc7 (diff)
Fix some of the Errors/warnings detected by checkapi.
svn path=/trunk/; revision=25288
Diffstat (limited to 'wiretap/ascend-scanner.l')
-rw-r--r--wiretap/ascend-scanner.l16
1 files changed, 7 insertions, 9 deletions
diff --git a/wiretap/ascend-scanner.l b/wiretap/ascend-scanner.l
index 52dfd723a9..59908aea6b 100644
--- a/wiretap/ascend-scanner.l
+++ b/wiretap/ascend-scanner.l
@@ -170,7 +170,7 @@ WDD_TYPE "type "[^\n\r\t ]+
}
<sc_wds_user>[^:]+ {
- char *atcopy = strdup(ascendtext);
+ char *atcopy = g_strdup(ascendtext);
char colon = input();
char after = input();
int retval = STRING;
@@ -180,18 +180,17 @@ WDD_TYPE "type "[^\n\r\t ]+
if (after != '(' && after != ' ') {
BEGIN(sc_wds_sess);
if (pseudo_header != NULL) {
- strncpy(pseudo_header->user, atcopy, ASCEND_MAX_STR_LEN);
- pseudo_header->user[ASCEND_MAX_STR_LEN - 1] = '\0';
+ g_strlcpy(pseudo_header->user, atcopy, ASCEND_MAX_STR_LEN);
}
} else { /* We have a version 7 file */
BEGIN(sc_gen_task);
if (pseudo_header != NULL) {
- strncpy(pseudo_header->user, NO_USER, ASCEND_MAX_STR_LEN);
+ g_strlcpy(pseudo_header->user, NO_USER, ASCEND_MAX_STR_LEN);
}
ascendlval.d = strtol(ascendtext, NULL, 10);
retval = DECNUM;
}
- free (atcopy);
+ g_free (atcopy);
return retval;
}
@@ -218,13 +217,13 @@ WDD_TYPE "type "[^\n\r\t ]+
}
<sc_gen_time_u>{D}+ {
- char *atcopy = strdup(ascendtext);
+ char *atcopy = g_strdup(ascendtext);
BEGIN(sc_gen_octets);
/* only want the most significant 2 digits. convert to usecs */
if (strlen(atcopy) > 2)
atcopy[2] = '\0';
ascendlval.d = strtol(atcopy, NULL, 10) * 10000;
- free(atcopy);
+ g_free(atcopy);
return DECNUM;
}
@@ -306,8 +305,7 @@ WDD_TYPE "type "[^\n\r\t ]+
<sc_wdd_callnum>{WDD_CALLNUM} {
BEGIN(sc_wdd_chunk);
if (pseudo_header != NULL) {
- strncpy(pseudo_header->call_num, ascendtext, ASCEND_MAX_STR_LEN);
- pseudo_header->call_num[ASCEND_MAX_STR_LEN - 1] = '\0';
+ g_strlcpy(pseudo_header->call_num, ascendtext, ASCEND_MAX_STR_LEN);
}
return STRING;
}