Skip to content

Commit 15549c1

Browse files
committed
plugins types BUGFIX avoid OOB int paring errors
1 parent b7b29e6 commit 15549c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/plugins_types.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ lyplg_type_parse_int(const char *datatype, int base, int64_t min, int64_t max, c
324324
/* consume leading whitespaces */
325325
for ( ; value_len && isspace(*value); ++value, --value_len) {}
326326

327-
if (!value || !value[0] || !value_len) {
327+
if (!value || !value_len || !value[0]) {
328328
return ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Invalid empty %s value.", datatype);
329329
}
330330

@@ -349,7 +349,7 @@ lyplg_type_parse_uint(const char *datatype, int base, uint64_t max, const char *
349349
/* consume leading whitespaces */
350350
for ( ; value_len && isspace(*value); ++value, --value_len) {}
351351

352-
if (!value || !value[0] || !value_len) {
352+
if (!value || !value_len || !value[0]) {
353353
return ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Invalid empty %s value.", datatype);
354354
}
355355

0 commit comments

Comments
 (0)