catapult: use ws_strtou/i functions.

Change-Id: I0a9d3674c0cc2d0dba8c1fbeba2d739373cf8655
Reviewed-on: https://code.wireshark.org/review/17535
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Dario Lombardo 2016-09-06 17:44:56 +02:00 committed by Guy Harris
parent 1948f7bd75
commit 113c1ed24f
1 changed files with 14 additions and 4 deletions

View File

@ -25,6 +25,7 @@
#include "wtap-int.h" #include "wtap-int.h"
#include "file_wrappers.h" #include "file_wrappers.h"
#include <wsutil/strtoi.h>
#include "catapult_dct2000.h" #include "catapult_dct2000.h"
@ -924,7 +925,9 @@ parse_line(gchar *linebuff, gint line_length,
*context_portp = port_number_string[0] - '0'; *context_portp = port_number_string[0] - '0';
} }
else { else {
*context_portp = atoi(port_number_string); if (!ws_strtou8(port_number_string, NULL, context_portp)) {
return FALSE;
}
} }
/* Skip it */ /* Skip it */
n++; n++;
@ -973,7 +976,9 @@ parse_line(gchar *linebuff, gint line_length,
variant = variant_name[0] - '0'; variant = variant_name[0] - '0';
} }
else { else {
variant = atoi(variant_name); if (!ws_strtoi32(variant_name, NULL, &variant)) {
return FALSE;
}
} }
} }
else { else {
@ -1198,7 +1203,9 @@ parse_line(gchar *linebuff, gint line_length,
/* Convert found value into number */ /* Convert found value into number */
seconds_buff[seconds_chars] = '\0'; seconds_buff[seconds_chars] = '\0';
*seconds = atoi(seconds_buff); if (!ws_strtoi32(seconds_buff, NULL, seconds)) {
return FALSE;
}
/* The decimal point must follow the last of the seconds digits */ /* The decimal point must follow the last of the seconds digits */
if (linebuff[n] != '.') { if (linebuff[n] != '.') {
@ -1225,7 +1232,10 @@ parse_line(gchar *linebuff, gint line_length,
} }
/* Convert found value into microseconds */ /* Convert found value into microseconds */
subsecond_decimals_buff[subsecond_decimals_chars] = '\0'; subsecond_decimals_buff[subsecond_decimals_chars] = '\0';
*useconds = atoi(subsecond_decimals_buff) * 100; if (!ws_strtoi32(subsecond_decimals_buff, NULL, useconds)) {
return FALSE;
}
(*useconds) *= 100;
/* Space character must follow end of timestamp */ /* Space character must follow end of timestamp */
if (linebuff[n] != ' ') { if (linebuff[n] != ' ') {