Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
if (!vendor)
vendor = "unknown";
+ // Create a working copy on the stack and sanitize it
+ char* suffix = strdupa(vendor);
+ if (!suffix) {
+ errno = ENOMEM;
+ return 1;
+ }
+
+ // Cut off suffix if it contains spaces
+ char* space = strchr(suffix, ' ');
+ if (space)
+ *space = '\0';
+
// Format string
- int r = snprintf(buffer, length, "%s-%s-linux-gnu", arch, vendor);
+ int r = snprintf(buffer, length, "%s-%s-linux-gnu", arch, suffix);
if (r < 0)
return r;