diff options
author | Toomas Soome <tsoome@me.com> | 2019-06-22 08:56:38 +0300 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2019-06-27 23:12:09 +0300 |
commit | 082e84855d5f07c088beac66080cad0b6e1dadc3 (patch) | |
tree | 8b9abb6cd3aee96c6eb7a2be229760badc6d65e1 | |
parent | d4de1381101f6e9d28fd5cb63b4480a97492b1de (diff) | |
download | illumos-joyent-082e84855d5f07c088beac66080cad0b6e1dadc3.tar.gz |
11270 libipp-listener: strtok() can return NULL and we do leak open file
Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
Reviewed by: Norm Jacobs <naj@snapcon.com>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/lib/print/libipp-listener/common/common.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr/src/lib/print/libipp-listener/common/common.c b/usr/src/lib/print/libipp-listener/common/common.c index a18797a879..22ec0dc07d 100644 --- a/usr/src/lib/print/libipp-listener/common/common.c +++ b/usr/src/lib/print/libipp-listener/common/common.c @@ -232,7 +232,6 @@ add_supported_locales(papi_attribute_t ***attributes) papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE, "generated-natural-language-supported", "en-us"); -#ifndef __linux__ /* this is Solaris specific */ if ((fp = fopen("/usr/lib/locale/lcttab", "r")) != NULL) { char buf[1024]; @@ -241,6 +240,8 @@ add_supported_locales(papi_attribute_t ***attributes) int i, passed = 1; name = strtok(buf, " \t\n"); + if (name == NULL) + continue; for (i = 0; ((passed == 1) && (name[i] != NULL)); i++) if (isalpha(name[i]) != 0) @@ -264,8 +265,8 @@ add_supported_locales(papi_attribute_t ***attributes) name); } } + (void) fclose(fp); } -#endif } void |