www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20871] New: std.socket.UnixAddress trusted functions can

https://issues.dlang.org/show_bug.cgi?id=20871

          Issue ID: 20871
           Summary: std.socket.UnixAddress  trusted functions can corrupt
                    memory if inherited from
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Keywords: safe
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: pro.mathias.lang gmail.com

```
import std.socket;
import std.stdio;

class Oops : UnixAddress
{
    override void setNameLen (socklen_t)  safe
    {
        this._nameLen = 99999;
    }
}

void main()  safe
{
    auto un = new Oops();
    un.setNameLen(0);
    writeln(un.path());
}
```

```
dmd -preview=dip1000 -run foo.d

```

--
May 28 2020