/*
- * Copyright (C) 2015-2017 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2015-2021 Andrea Zagli <azagli@libero.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
}
else if (g_strcmp0 (format_tokens[i], "%H") == 0)
{
- hour = strtol (str_tokens[i], NULL, 10);
- if (hour > 23)
+ char *ptr;
+
+ hour = strtol (str_tokens[i], &ptr, 10);
+ if ((ptr != NULL && g_strcmp0 (ptr, "") != 0)
+ || hour > 23)
{
error = TRUE;
break;
}
else if (g_strcmp0 (format_tokens[i], "%M") == 0)
{
- minute = strtol (str_tokens[i], NULL, 10);
- if (minute > 59)
+ char *ptr;
+
+ minute = strtol (str_tokens[i], &ptr, 10);
+ if ((ptr != NULL && g_strcmp0 (ptr, "") != 0)
+ || minute > 59)
{
error = TRUE;
break;
}
else if (g_strcmp0 (format_tokens[i], "%S") == 0)
{
- seconds = g_strtod (str_tokens[i], NULL);
- if (seconds > 59.0)
+ char *ptr;
+
+ seconds = g_strtod (str_tokens[i], &ptr);
+ if ((ptr != NULL && g_strcmp0 (ptr, "") != 0)
+ || seconds > 59.0)
{
error = TRUE;
break;