Checked the number of subauthorities before accessing them

Be more crash resistent when analyzing a badly formed SID.
(contributed by Ulf Zibis)
This commit is contained in:
Jean-Pierre André 2016-05-04 09:27:32 +02:00
parent d587ff54f9
commit 1b8b599408

View File

@ -971,10 +971,11 @@ static void showsid(const char *attr, int off, const char *prefix, int level)
marker = ' ';
cnt = attr[off+1] & 255;
auth = get6h(attr,off+2);
first = get4l(attr,off+8);
known = FALSE;
if ((attr[off] == 1) /* revision */
&& (auth < 100))
&& cnt
&& (auth < 100)) {
first = get4l(attr,off+8);
switch (cnt) {
case 0 : /* no level (error) */
break;
@ -1105,6 +1106,7 @@ static void showsid(const char *attr, int off, const char *prefix, int level)
break;
}
}
}
if (!known)
printf("%*cUnknown SID\n",-level,marker);
printf("%*c%shex S-%d-",-level,marker,prefix,attr[off] & 255);