mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-05 06:20:00 +02:00
asc2log: shrink string buffer for header analysis
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
This commit is contained in:
@@ -843,7 +843,7 @@ static int get_date(struct timeval *tv, char *date)
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char buf[BUFLEN], tmp1[BUFLEN], tmp2[BUFLEN];
|
char buf[BUFLEN], tmp1[10], tmp2[10];
|
||||||
|
|
||||||
FILE *infile = stdin;
|
FILE *infile = stdin;
|
||||||
FILE *outfile = stdout;
|
FILE *outfile = stdout;
|
||||||
@@ -897,7 +897,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* check for base and timestamp entries in the header */
|
/* check for base and timestamp entries in the header */
|
||||||
if ((!base) &&
|
if ((!base) &&
|
||||||
(sscanf(buf, "base %s timestamps %s", tmp1, tmp2) == 2)) {
|
(sscanf(buf, "base %9s timestamps %9s", tmp1, tmp2) == 2)) {
|
||||||
base = tmp1[0];
|
base = tmp1[0];
|
||||||
timestamps = tmp2[0];
|
timestamps = tmp2[0];
|
||||||
if (verbose)
|
if (verbose)
|
||||||
@@ -931,7 +931,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check for decimal places length in valid CAN frames */
|
/* check for decimal places length in valid CAN frames */
|
||||||
if (sscanf(buf, "%llu.%s %s ", &sec, tmp2,
|
if (sscanf(buf, "%llu.%9s %9s ", &sec, tmp2,
|
||||||
tmp1) != 3)
|
tmp1) != 3)
|
||||||
continue; /* dplace remains zero until first found CAN frame */
|
continue; /* dplace remains zero until first found CAN frame */
|
||||||
|
|
||||||
@@ -952,7 +952,7 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* check classic CAN format or the CANFD/CANXL tag which can take different types */
|
/* check classic CAN format or the CANFD/CANXL tag which can take different types */
|
||||||
if (sscanf(buf, "%llu.%llu %s ", &sec, &usec, tmp1) == 3){
|
if (sscanf(buf, "%llu.%llu %9s ", &sec, &usec, tmp1) == 3) {
|
||||||
if (!strncmp(tmp1, "CANXL", 5))
|
if (!strncmp(tmp1, "CANXL", 5))
|
||||||
eval_canxl(buf, &date_tv, timestamps, dplace, outfile);
|
eval_canxl(buf, &date_tv, timestamps, dplace, outfile);
|
||||||
else if (!strncmp(tmp1, "CANFD", 5))
|
else if (!strncmp(tmp1, "CANFD", 5))
|
||||||
|
|||||||
Reference in New Issue
Block a user