Fix potential NULL-write in aa_getprocattr() error path

https://bugs.launchpad.net/apparmor/+bug/1196880

Patch by Gernot Vormayr <gvormayr@gmail.com>

Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
Seth Arnold 2013-07-02 11:53:31 -07:00
parent 2c6e1b6e0f
commit b77a05aa52

View file

@ -279,7 +279,8 @@ int aa_getprocattr(pid_t tid, const char *attr, char **buf, char **mode)
if (rc == -1) {
free(buffer);
*buf = NULL;
*mode = NULL;
if (mode)
*mode = NULL;
} else
*buf = buffer;