From w||||@m@mcc|enn@n @end|ng |rom gm@||@com  Thu Jul 13 00:26:56 2023
From: w||||@m@mcc|enn@n @end|ng |rom gm@||@com (Will McClennan)
Date: Wed, 12 Jul 2023 18:26:56 -0400
Subject: [Rd] Incorrect type in malloc in Rscript.c
Message-ID: <69F17DDB-3725-42F7-AE2B-5682C4AE82AA@gmail.com>

I downloaded and compiled R-4.3.1 from cran.rstudio.com and on line 405 of Rscript.c in src/unix the line of code

char *buf=(char*) malloc((size_t) (len+1)*sizeof(char *));

appears to be wrong to me. If an array of char* is being allocated then the argument to sizeof should be char and not char*. On a 64 bit machine this will allocate 8 times as much memory as needed. For this reason the code works but it is an incorrect. Not a big issue though.

Will McClennan


[Rd] Incorrect type in malloc in Rscript.c
Will McClennan