| 1 |
Description: fix SIGSEGV with crafted package in rplay_unpack() |
| 2 |
A security issue in function rplay_unpack() of librplay has been found (CVE-2025-62672). |
| 3 |
Unfortunately this issue can not be fixed in rplay_unpack(), so this function has been |
| 4 |
deprecated and a new function rplay_unpack_n() has been introduced. The old function |
| 5 |
rplay_unpack() now always returns an error. |
| 6 |
According to codesearch.d.n, rplay_unpack() is only used in rplay itself but not |
| 7 |
in any reverse dependency, so no other package should be affected by this change. |
| 8 |
Index: rplay-3.3.2/librplay/rplay.c |
| 9 |
=================================================================== |
| 10 |
--- rplay-3.3.2.orig/librplay/rplay.c 2025-11-22 23:52:51.264632351 +0000 |
| 11 |
+++ rplay-3.3.2/librplay/rplay.c 2025-11-22 23:53:36.506572915 +0000 |
| 12 |
@@ -358,6 +358,11 @@ |
| 13 |
} |
| 14 |
|
| 15 |
/* |
| 16 |
+ * rplay_unpack() is affected by CVE-2025-62672, which can not be fixed in this function |
| 17 |
+ * therefore this function is deprecated and only returns an error |
| 18 |
+ * please use rplay_unpack_n(char *packet, int length) instead |
| 19 |
+ */ |
| 20 |
+/* |
| 21 |
* unpack an rplay packet into an rplay object |
| 22 |
*/ |
| 23 |
#ifdef __STDC__ |
| 24 |
@@ -369,6 +374,23 @@ |
| 25 |
char *packet; |
| 26 |
#endif |
| 27 |
{ |
| 28 |
+ rplay_errno = RPLAY_ERROR_MEMORY; |
| 29 |
+ return NULL; |
| 30 |
+} |
| 31 |
+ |
| 32 |
+/* |
| 33 |
+ * unpack an rplay packet into an rplay object |
| 34 |
+ */ |
| 35 |
+#ifdef __STDC__ |
| 36 |
+RPLAY * |
| 37 |
+rplay_unpack_n(char *packet, int length) |
| 38 |
+#else |
| 39 |
+RPLAY * |
| 40 |
+rplay_unpack_n(packet, length) |
| 41 |
+ char *packet; |
| 42 |
+ int length; |
| 43 |
+#endif |
| 44 |
+{ |
| 45 |
RPLAY *rp; |
| 46 |
int still_going = 1; |
| 47 |
int version; |
| 48 |
@@ -467,6 +489,10 @@ |
| 49 |
break; |
| 50 |
|
| 51 |
case RPLAY_DATA: |
| 52 |
+ if (rp->data_size>length) { |
| 53 |
+ rplay_errno = RPLAY_ERROR_MEMORY; |
| 54 |
+ return NULL; |
| 55 |
+ } |
| 56 |
rp->data = (char *) malloc(rp->data_size); |
| 57 |
memcpy(rp->data, packet, rp->data_size); |
| 58 |
packet += rp->data_size; |
| 59 |
Index: rplay-3.3.2/ChangeLog |
| 60 |
=================================================================== |
| 61 |
--- rplay-3.3.2.orig/ChangeLog 2025-11-22 23:52:51.264632351 +0000 |
| 62 |
+++ rplay-3.3.2/ChangeLog 2025-11-22 23:52:51.259411787 +0000 |
| 63 |
@@ -1,3 +1,8 @@ |
| 64 |
+2025-11-20 Thorsten Alteholz <[email protected]> |
| 65 |
+ |
| 66 |
+ * deprecate rplay_unpack() and recommend usage |
| 67 |
+ of rplay_unpack_n() |
| 68 |
+ |
| 69 |
1999-03-21 Mark R. Boyns <[email protected]> |
| 70 |
|
| 71 |
* fixed Makefile dependencies and shared library builds. |
| 72 |
Index: rplay-3.3.2/doc/librplay.info |
| 73 |
=================================================================== |
| 74 |
--- rplay-3.3.2.orig/doc/librplay.info 2025-11-22 23:52:51.264632351 +0000 |
| 75 |
+++ rplay-3.3.2/doc/librplay.info 2025-11-22 23:52:51.259626504 +0000 |
| 76 |
@@ -454,7 +454,7 @@ |
| 77 |
|
| 78 |
The return value is `0' on success and `-1' on failure. |
| 79 |
|
| 80 |
|
| 81 |
+ - Function: RPLAY * rplay_unpack (char *RAW_PTR) (this function is DEPRECATED) |
| 82 |
Unpack a raw rplay 3.0 packet into a new RPLAY object. |
| 83 |
|
| 84 |
The RAW_PTR argument should be a pointer to a rplay 3.0 packet |
| 85 |
@@ -462,6 +462,16 @@ |
| 86 |
|
| 87 |
The return value is a pointer to a new RPLAY object that is created |
| 88 |
using `rplay_create'. |
| 89 |
+ |
| 90 |
+ - Function: RPLAY * rplay_unpack (char *RAW_PTR, int LENGTH) |
| 91 |
+ Unpack a raw rplay 3.0 packet into a new RPLAY object. |
| 92 |
+ |
| 93 |
+ The RAW_PTR argument should be a pointer to a rplay 3.0 packet |
| 94 |
+ sent by a rplay client. |
| 95 |
+ The LENGTH argument is the allocated length of RAW_PTR. |
| 96 |
+ |
| 97 |
+ The return value is a pointer to a new RPLAY object that is created |
| 98 |
+ using `rplay_create'. |
| 99 |
|
| 100 |
|
| 101 |
File: librplay.info, Node: RPLAY Error Reporting, Next: RPTP Core Functions, Prev: RPLAY Miscellaneous Functions, Up: Top |
| 102 |
Index: rplay-3.3.2/doc/librplay.texi |
| 103 |
=================================================================== |
| 104 |
--- rplay-3.3.2.orig/doc/librplay.texi 2025-11-22 23:52:51.264632351 +0000 |
| 105 |
+++ rplay-3.3.2/doc/librplay.texi 2025-11-22 23:52:51.259812174 +0000 |
| 106 |
@@ -619,7 +619,7 @@ |
| 107 |
@end deftypefun |
| 108 |
|
| 109 |
@c |
| 110 |
|
| 111 |
+@c rplay_unpack (this function is DEPRECATED) |
| 112 |
@c |
| 113 |
@deftypefun {RPLAY *} rplay_unpack (char *@var{raw_ptr}) |
| 114 |
Unpack a raw rplay 3.0 packet into a new RPLAY object. |
| 115 |
@@ -629,6 +629,23 @@ |
| 116 |
|
| 117 |
The return value is a pointer to a new RPLAY object that is created |
| 118 |
using @code{rplay_create}. |
| 119 |
+@end deftypefun |
| 120 |
+ |
| 121 |
+@node RPLAY Error Reporting, RPTP Core Functions, RPLAY Miscellaneous Functions, Top |
| 122 |
+@chapter RPLAY Error Reporting |
| 123 |
+ |
| 124 |
+@c |
| 125 |
+@c rplay_unpack_n |
| 126 |
+@c |
| 127 |
+@deftypefun {RPLAY *} rplay_unpack_n (char *@var{raw_ptr}, int @var{length}) |
| 128 |
+Unpack a raw rplay 3.0 packet into a new RPLAY object. |
| 129 |
+ |
| 130 |
+The @var{raw_ptr} argument should be a pointer to a rplay 3.0 packet |
| 131 |
+sent by a rplay client. |
| 132 |
+The @var{length} argument is the allocated length of @var{raw_ptr}. |
| 133 |
+ |
| 134 |
+The return value is a pointer to a new RPLAY object that is created |
| 135 |
+using @code{rplay_create}. |
| 136 |
@end deftypefun |
| 137 |
|
| 138 |
@node RPLAY Error Reporting, RPTP Core Functions, RPLAY Miscellaneous Functions, Top |
| 139 |
Index: rplay-3.3.2/include/rplay.h |
| 140 |
=================================================================== |
| 141 |
--- rplay-3.3.2.orig/include/rplay.h 2025-11-22 23:52:51.264632351 +0000 |
| 142 |
+++ rplay-3.3.2/include/rplay.h 2025-11-22 23:52:51.259951056 +0000 |
| 143 |
@@ -244,6 +244,7 @@ |
| 144 |
extern char *rplay_convert (char *buf); |
| 145 |
extern int rplay_pack (RPLAY * rp); |
| 146 |
extern RPLAY *rplay_unpack (char *buf); |
| 147 |
+extern RPLAY *rplay_unpack_n (char *buf, int length); |
| 148 |
extern void rplay_destroy (RPLAY * rp); |
| 149 |
extern long rplay_set (RPLAY *,...); |
| 150 |
extern long rplay_get (RPLAY *,...); |
| 151 |
@@ -286,6 +287,7 @@ |
| 152 |
extern char *rplay_convert ( /* char *buf */ ); |
| 153 |
extern int rplay_pack ( /* RPLAY *rp */ ); |
| 154 |
extern RPLAY *rplay_unpack ( /* char *buf */ ); |
| 155 |
+extern RPLAY *rplay_unpack_n ( /* char *buf, int length */ ); |
| 156 |
extern void rplay_destroy ( /* RPLAY *rp */ ); |
| 157 |
extern int rplay_set ( /* RPLAY *, ... */ ); |
| 158 |
extern int rplay_get ( /* RPLAY *, ... */ ); |
| 159 |
Index: rplay-3.3.2/rplayd/rplayd.c |
| 160 |
=================================================================== |
| 161 |
--- rplay-3.3.2.orig/rplayd/rplayd.c 2025-11-22 23:52:51.264632351 +0000 |
| 162 |
+++ rplay-3.3.2/rplayd/rplayd.c 2025-11-22 23:52:51.260165703 +0000 |
| 163 |
@@ -1563,10 +1563,10 @@ |
| 164 |
#endif /* OLD_RPLAY */ |
| 165 |
|
| 166 |
case RPLAY_PACKET_ID: |
| 167 |
|
| 168 |
+ rp = rplay_unpack_n(packet, MAX_PACKET); |
| 169 |
if (rp == NULL) |
| 170 |
{ |
| 171 |
|
| 172 |
+ report(REPORT_ERROR, "rplay_unpack_n: %s\n", rplay_errlist[rplay_errno]); |
| 173 |
break; |
| 174 |
} |
| 175 |
|