Branch: Tag:

1998-01-17

1998-01-17 18:00:11 by Henrik Grubbström (Grubba) <grubba@grubba.org>

read_file() and read_bytes() now only allow regular files.

Rev: lib/modules/Stdio.pmod:1.8

155:    f=FILE();    if(!f->open(filename,"r")) return 0;    +  // Disallow devices and directories. +  array st; +  if (f->stat && (st = f->stat()) && (st[1] < 0)) { +  throw(({ sprintf("Stdio.read_file(): File \"%s\" is not a regular file!\n", +  filename), +  backtrace() +  })); +  } +     switch(query_num_arg())    {    case 1:
187:    if(!f->open(filename,"r"))    return 0;    +  // Disallow devices and directories. +  array st; +  if (f->stat && (st = f->stat()) && (st[1] < 0)) { +  throw(({sprintf("Stdio.read_bytes(): File \"%s\" is not a regular file!\n", +  filename), +  backtrace() +  })); +  } +     switch(query_num_arg())    {    case 1: