--- /dev/null
+commit ffb1a4a37d2c876e3feeb31df4930f2aed7fa030
+Author: Marco Eichelberg <eichelberg@offis.de>
+Date: Fri Nov 28 12:24:07 2025 +0100
+
+ Fixed two possible segfaults in dcmqrscp.
+
+ Fixed two places where invalid messages may trigger a segmentation fault
+ due to a NULL pointer being de-referenced.
+
+ Thanks to 邹 迪凯 <zoudikai@outlook.com> for the bug report and proof-of-concept.
+
+--- dcmtk.orig/dcmqrdb/libsrc/dcmqrdbi.cc
++++ dcmtk/dcmqrdb/libsrc/dcmqrdbi.cc
+@@ -1381,8 +1381,10 @@
+ /* only char string type tags are supported at the moment */
+ char *s = NULL;
+ dcelem->getString(s);
++
+ /* the available space is always elem.ValueLength+1 */
+- OFStandard::strlcpy(elem.PValueField, s, elem.ValueLength+1);
++ if (s) OFStandard::strlcpy(elem.PValueField, s, elem.ValueLength+1);
++ else elem.PValueField[0]='\0';
+ }
+ /** If element is the Query Level, store it in handle
+ */
+@@ -2066,8 +2068,10 @@
+ /* only char string type tags are supported at the moment */
+ char *s = NULL;
+ dcelem->getString(s);
++
+ /* the available space is always elem.ValueLength+1 */
+- OFStandard::strlcpy(elem.PValueField, s, elem.ValueLength+1);
++ if (s) OFStandard::strlcpy(elem.PValueField, s, elem.ValueLength+1);
++ else elem.PValueField[0]='\0';
+ }
+
+ /** If element is the Query Level, store it in handle