From 6d7acaa1000e9540ed9b5baf51dc023bcefab551 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 26 Aug 2021 10:14:27 +0200 Subject: [PATCH] Made sure cdrom_image.c doesn't strcpy() from the same place to the same place. --- src/cdrom/cdrom_image.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cdrom/cdrom_image.c b/src/cdrom/cdrom_image.c index d494523e8..2df0801c3 100644 --- a/src/cdrom/cdrom_image.c +++ b/src/cdrom/cdrom_image.c @@ -253,7 +253,10 @@ cdrom_image_open(cdrom_t *dev, const char *fn) { cd_img_t *img; - strcpy(dev->image_path, fn); + /* Make sure to not STRCPY if the two are pointing + at the same place. */ + if (fn != dev->image_path) + strcpy(dev->image_path, fn); /* Create new instance of the CDROM_Image class. */ img = (cd_img_t *) malloc(sizeof(cd_img_t));