Skip to content

Build: exclude regex when already provided by the system#589

Merged
dnzbk merged 2 commits intonzbgetcom:developfrom
Coeur:coeur/regex.h
Jun 13, 2025
Merged

Build: exclude regex when already provided by the system#589
dnzbk merged 2 commits intonzbgetcom:developfrom
Coeur:coeur/regex.h

Conversation

@Coeur
Copy link
Copy Markdown
Contributor

@Coeur Coeur commented Jun 13, 2025

Description

nzbget includes a quite old version of the glibc regex.
Building and using such old version of regex is unnecessary in most platforms, as the latest and better versions of regex are included in all POSIX distributions for decades.

The old embedded regex is showing various concerning issues:

  • potential memory leaks in re_dfa_add_node from the re_realloc calls
  • dereference of null pointer in create_initial_state
  • dereference of null pointer in calc_first
  • dereference of null pointer in duplicate_tree
  • potential memory leaks in re_copy_regs from the re_realloc calls
  • dereference of null pointer in re_search_internal
  • attempt to free released memory in prune_impossible_nodes
  • assigned value is garbage or undefined in build_trtable
  • use of function alloca is discouraged; there is no way to check for failure but failure may still occur, resulting in a possibly exploitable security vulnerability

Hence the best initial action is to avoid using this old code altogether when it's not necessary.

@dnzbk dnzbk self-requested a review June 13, 2025 13:34
Copy link
Copy Markdown
Collaborator

@dnzbk dnzbk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@dnzbk dnzbk merged commit c986745 into nzbgetcom:develop Jun 13, 2025
9 checks passed
@Coeur Coeur deleted the coeur/regex.h branch June 13, 2025 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants