os: util: protect set_font_authorizations() from allocation failure
| ../os/utils.c: In function ‘set_font_authorizations’: | ../os/utils.c:863:14: warning: dereference of possibly-NULL ‘result’ [CWE-690] [-Wanalyzer-possible-null-dereference] | 863 | *p++ = sizeof(AUTHORIZATION_NAME) >> 8; | | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
eb09c17a54
commit
c389f28af0
|
@ -817,7 +817,9 @@ set_font_authorizations(char **authorizations, int *authlen, void *client)
|
|||
#endif
|
||||
|
||||
len = strlen(hnameptr) + 1;
|
||||
result = malloc(len + sizeof(AUTHORIZATION_NAME) + 4);
|
||||
result = calloc(1, len + sizeof(AUTHORIZATION_NAME) + 4);
|
||||
if (!result)
|
||||
return 0;
|
||||
|
||||
p = result;
|
||||
*p++ = sizeof(AUTHORIZATION_NAME) >> 8;
|
||||
|
|
Loading…
Reference in New Issue