]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Use safer htsmsg_add_str2 when copying de->de_directory
authorBrett T. Warden <brett.warden@gmail.com>
Mon, 17 Jun 2024 20:56:11 +0000 (13:56 -0700)
committerFlole <Flole998@users.noreply.github.com>
Tue, 18 Jun 2024 16:50:09 +0000 (18:50 +0200)
de->de_directory may be null. htsmsg_add_str passes str unchecked to underlying strlen function. __strlen_avx2 will segfault if str is null.

htsmsg_add_str2 checks the value of args before passing them to htsmsg_add_str, which should prevent this.

Fixes #1712

src/dvr/dvr_db.c

index 5a625d32915a911896e2aa1d88ad2efd6bf1bddc..fd45b975115372114835fd42f211d27b501ccd99 100644 (file)
@@ -1480,7 +1480,7 @@ not_so_good:
   htsmsg_add_str2(conf, "owner", de->de_owner);
   htsmsg_add_str2(conf, "creator", de->de_creator);
   htsmsg_add_str(conf, "comment", buf);
-  htsmsg_add_str(conf, "directory", de->de_directory);
+  htsmsg_add_str2(conf, "directory", de->de_directory);
   de2 = dvr_entry_create_from_htsmsg(conf, e);
   htsmsg_destroy(conf);