From: kremlin Date: Thu, 7 Aug 2014 05:10:15 +0000 (-0500) Subject: minor, add generous fixed buffer for sysctl strings X-Git-Tag: gsoc-final~33 X-Git-Url: https://uglyman.kremlin.cc/gitweb/gitweb.cgi?a=commitdiff_plain;h=b81ab32a35147a06710a58f32283d12b08599ea7;p=systembsd.git minor, add generous fixed buffer for sysctl strings --- diff --git a/src/interfaces/hostnamed/hostnamed.c b/src/interfaces/hostnamed/hostnamed.c index fae193e..f1c3fb4 100644 --- a/src/interfaces/hostnamed/hostnamed.c +++ b/src/interfaces/hostnamed/hostnamed.c @@ -399,16 +399,22 @@ int main() { gboolean determine_chassis_and_icon() { + const size_t bufsize = 4096; + char *hwproduct, *hwmodel, *hwvendor, *hwmachine; size_t hwproduct_size, hwmodel_size, hwvendor_size, hwmachine_size; int hwproduct_name[2], hwmodel_name[2], hwvendor_name[2], hwmachine_name[2]; unsigned int i; gboolean UNSURE_CHASSIS_FLAG, UNSURE_ICON_FLAG; - hwproduct = hwmodel = hwvendor = hwmachine = NULL; - hwproduct_size = hwmodel_size = hwvendor_size = hwmachine_size = 0; + hwproduct_size = hwmodel_size = hwvendor_size = hwmachine_size = bufsize; UNSURE_CHASSIS_FLAG = UNSURE_ICON_FLAG = FALSE; + hwproduct = (char*)g_malloc0(4096); + hwmodel = (char*)g_malloc0(4096); + hwvendor = (char*)g_malloc0(4096); + hwmachine = (char*)g_malloc0(4096); + hwproduct_name[0] = CTL_HW; hwproduct_name[1] = HW_PRODUCT;