aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkremlin <ian@kremlin.cc>2014-08-07 13:10:15 +0800
committerkremlin <ian@kremlin.cc>2014-08-07 13:10:15 +0800
commitb81ab32a35147a06710a58f32283d12b08599ea7 (patch)
treed0f3867ee402656c65261cab037c52ab65b53423
parent68e777c60747f9701ff48e0135c4a5bb08ad0acc (diff)
downloadsystembsd-b81ab32a35147a06710a58f32283d12b08599ea7.tar
systembsd-b81ab32a35147a06710a58f32283d12b08599ea7.tar.gz
systembsd-b81ab32a35147a06710a58f32283d12b08599ea7.tar.bz2
systembsd-b81ab32a35147a06710a58f32283d12b08599ea7.tar.lz
systembsd-b81ab32a35147a06710a58f32283d12b08599ea7.tar.xz
systembsd-b81ab32a35147a06710a58f32283d12b08599ea7.tar.zst
systembsd-b81ab32a35147a06710a58f32283d12b08599ea7.zip
minor, add generous fixed buffer for sysctl strings
-rw-r--r--src/interfaces/hostnamed/hostnamed.c10
1 files changed, 8 insertions, 2 deletions
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;