Description: fix SIGSEGV with crafted package in rplay_unpack() A security issue in function rplay_unpack() of librplay has been found (CVE-2025-62672). Unfortunately this issue can not be fixed in rplay_unpack(), so this function has been deprecated and a new function rplay_unpack_n() has been introduced. The old function rplay_unpack() now always returns an error. According to codesearch.d.n, rplay_unpack() is only used in rplay itself but not in any reverse dependency, so no other package should be affected by this change. Index: rplay-3.3.2/librplay/rplay.c =================================================================== --- rplay-3.3.2.orig/librplay/rplay.c 2025-11-22 23:52:51.264632351 +0000 +++ rplay-3.3.2/librplay/rplay.c 2025-11-22 23:53:36.506572915 +0000 @@ -358,6 +358,11 @@ } /* + * rplay_unpack() is affected by CVE-2025-62672, which can not be fixed in this function + * therefore this function is deprecated and only returns an error + * please use rplay_unpack_n(char *packet, int length) instead + */ +/* * unpack an rplay packet into an rplay object */ #ifdef __STDC__ @@ -369,6 +374,23 @@ char *packet; #endif { + rplay_errno = RPLAY_ERROR_MEMORY; + return NULL; +} + +/* + * unpack an rplay packet into an rplay object + */ +#ifdef __STDC__ +RPLAY * +rplay_unpack_n(char *packet, int length) +#else +RPLAY * +rplay_unpack_n(packet, length) + char *packet; + int length; +#endif +{ RPLAY *rp; int still_going = 1; int version; @@ -467,6 +489,10 @@ break; case RPLAY_DATA: + if (rp->data_size>length) { + rplay_errno = RPLAY_ERROR_MEMORY; + return NULL; + } rp->data = (char *) malloc(rp->data_size); memcpy(rp->data, packet, rp->data_size); packet += rp->data_size; Index: rplay-3.3.2/ChangeLog =================================================================== --- rplay-3.3.2.orig/ChangeLog 2025-11-22 23:52:51.264632351 +0000 +++ rplay-3.3.2/ChangeLog 2025-11-22 23:52:51.259411787 +0000 @@ -1,3 +1,8 @@ +2025-11-20 Thorsten Alteholz + + * deprecate rplay_unpack() and recommend usage + of rplay_unpack_n() + 1999-03-21 Mark R. Boyns * fixed Makefile dependencies and shared library builds. Index: rplay-3.3.2/doc/librplay.info =================================================================== --- rplay-3.3.2.orig/doc/librplay.info 2025-11-22 23:52:51.264632351 +0000 +++ rplay-3.3.2/doc/librplay.info 2025-11-22 23:52:51.259626504 +0000 @@ -454,7 +454,7 @@ The return value is `0' on success and `-1' on failure. - - Function: RPLAY * rplay_unpack (char *RAW_PTR) + - Function: RPLAY * rplay_unpack (char *RAW_PTR) (this function is DEPRECATED) Unpack a raw rplay 3.0 packet into a new RPLAY object. The RAW_PTR argument should be a pointer to a rplay 3.0 packet @@ -462,6 +462,16 @@ The return value is a pointer to a new RPLAY object that is created using `rplay_create'. + + - Function: RPLAY * rplay_unpack (char *RAW_PTR, int LENGTH) + Unpack a raw rplay 3.0 packet into a new RPLAY object. + + The RAW_PTR argument should be a pointer to a rplay 3.0 packet + sent by a rplay client. + The LENGTH argument is the allocated length of RAW_PTR. + + The return value is a pointer to a new RPLAY object that is created + using `rplay_create'.  File: librplay.info, Node: RPLAY Error Reporting, Next: RPTP Core Functions, Prev: RPLAY Miscellaneous Functions, Up: Top Index: rplay-3.3.2/doc/librplay.texi =================================================================== --- rplay-3.3.2.orig/doc/librplay.texi 2025-11-22 23:52:51.264632351 +0000 +++ rplay-3.3.2/doc/librplay.texi 2025-11-22 23:52:51.259812174 +0000 @@ -619,7 +619,7 @@ @end deftypefun @c -@c rplay_unpack +@c rplay_unpack (this function is DEPRECATED) @c @deftypefun {RPLAY *} rplay_unpack (char *@var{raw_ptr}) Unpack a raw rplay 3.0 packet into a new RPLAY object. @@ -629,6 +629,23 @@ The return value is a pointer to a new RPLAY object that is created using @code{rplay_create}. +@end deftypefun + +@node RPLAY Error Reporting, RPTP Core Functions, RPLAY Miscellaneous Functions, Top +@chapter RPLAY Error Reporting + +@c +@c rplay_unpack_n +@c +@deftypefun {RPLAY *} rplay_unpack_n (char *@var{raw_ptr}, int @var{length}) +Unpack a raw rplay 3.0 packet into a new RPLAY object. + +The @var{raw_ptr} argument should be a pointer to a rplay 3.0 packet +sent by a rplay client. +The @var{length} argument is the allocated length of @var{raw_ptr}. + +The return value is a pointer to a new RPLAY object that is created +using @code{rplay_create}. @end deftypefun @node RPLAY Error Reporting, RPTP Core Functions, RPLAY Miscellaneous Functions, Top Index: rplay-3.3.2/include/rplay.h =================================================================== --- rplay-3.3.2.orig/include/rplay.h 2025-11-22 23:52:51.264632351 +0000 +++ rplay-3.3.2/include/rplay.h 2025-11-22 23:52:51.259951056 +0000 @@ -244,6 +244,7 @@ extern char *rplay_convert (char *buf); extern int rplay_pack (RPLAY * rp); extern RPLAY *rplay_unpack (char *buf); +extern RPLAY *rplay_unpack_n (char *buf, int length); extern void rplay_destroy (RPLAY * rp); extern long rplay_set (RPLAY *,...); extern long rplay_get (RPLAY *,...); @@ -286,6 +287,7 @@ extern char *rplay_convert ( /* char *buf */ ); extern int rplay_pack ( /* RPLAY *rp */ ); extern RPLAY *rplay_unpack ( /* char *buf */ ); +extern RPLAY *rplay_unpack_n ( /* char *buf, int length */ ); extern void rplay_destroy ( /* RPLAY *rp */ ); extern int rplay_set ( /* RPLAY *, ... */ ); extern int rplay_get ( /* RPLAY *, ... */ ); Index: rplay-3.3.2/rplayd/rplayd.c =================================================================== --- rplay-3.3.2.orig/rplayd/rplayd.c 2025-11-22 23:52:51.264632351 +0000 +++ rplay-3.3.2/rplayd/rplayd.c 2025-11-22 23:52:51.260165703 +0000 @@ -1563,10 +1563,10 @@ #endif /* OLD_RPLAY */ case RPLAY_PACKET_ID: - rp = rplay_unpack(packet); + rp = rplay_unpack_n(packet, MAX_PACKET); if (rp == NULL) { - report(REPORT_ERROR, "rplay_unpack: %s\n", rplay_errlist[rplay_errno]); + report(REPORT_ERROR, "rplay_unpack_n: %s\n", rplay_errlist[rplay_errno]); break; }