This is not quite right... The code is reading in the entire contents of the file into 'script', but ensuring that it is newline and nul terminated. So, keep the IO code the same, but build a stringref out of it afterwards when setting the script:
```
MCAutoPointer<char> script = new char[size + 2];
(*script)[size] = '\n';
(*script)[size + 1] = '\0'
if (IO_read(*script, size, stream) != IO_NORMAL)
  return IO_ERROR;
MCAutoStringRef t_script_str;
/* UNCHECKED */ MCStringCreateWithCString(*script, &t_script_str);
if (!stacks -> setscript(*t_script_str))
  return IO_ERROR;
```