From 117dfe96dd55ba809bcdce90f5595fb044569be3 Mon Sep 17 00:00:00 2001 From: TheDarkBug Date: Tue, 16 Mar 2021 15:26:25 +0100 Subject: [PATCH] Fixed #39 with gpu_name max length. --- uwufetch.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/uwufetch.c b/uwufetch.c index 7c38c60..e8329ef 100644 --- a/uwufetch.c +++ b/uwufetch.c @@ -198,13 +198,16 @@ void get_info() { // get all necessary info // gpu FILE *gpu; gpu = popen("lshw -class display 2> /dev/null", "r"); - while (fgets(line, sizeof(line), gpu)) if (sscanf(line, " product: %[^\n]", gpu_model)) break; + while (fgets(line, sizeof(line), gpu)) if (sscanf(line, " product: %[^\n]", gpu_model)) break; if (strlen(gpu_model) < 1) { if (strcmp(version_name, "android") != 0) gpu = popen("lspci -mm 2> /dev/null | grep \"VGA\\|00:02\" | cut --fields=4,6 -d '\"' --output-delimiter=\" \" | sed \"s/ Controller.*//\"", "r"); else gpu = popen("getprop ro.hardware.vulkan 2> /dev/null", "r"); while (fgets(line, sizeof(line), gpu)) if (sscanf(line, "%[^\n]", gpu_model)) break; } fclose(gpu); + for (int i = 42; i < 256; i++) { //max gpu_name length + gpu_model[i] = '\0'; + } pkgs = pkgman(); }