1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 23:36:37 +02:00

core: check that version is not NULL or empty string in function util_version_number

This commit is contained in:
Sébastien Helleu
2024-10-20 21:45:21 +02:00
parent 97e81e197d
commit 50a9c88b79
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -616,6 +616,9 @@ util_version_number (const char *version)
int num_items, i, version_int[4], index_buf;
long number;
if (!version || !version[0])
return 0;
items = string_split (version, ".", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
+4
View File
@@ -488,6 +488,10 @@ TEST(CoreUtil, ParseDelay)
TEST(CoreUtil, VersionNumber)
{
LONGS_EQUAL(0, util_version_number (NULL));
LONGS_EQUAL(0, util_version_number (""));
LONGS_EQUAL(0, util_version_number ("abc"));
LONGS_EQUAL(0x00030200, util_version_number ("0.3.2-dev"));
LONGS_EQUAL(0x00030200, util_version_number ("0.3.2-rc1"));
LONGS_EQUAL(0x00030200, util_version_number ("0.3.2"));