diff --git a/c-programming/sys/cpuid_vendor_id.mod.c b/c-programming/sys/cpuid_vendor_id.mod.c index 9e722bf..89232a2 100644 --- a/c-programming/sys/cpuid_vendor_id.mod.c +++ b/c-programming/sys/cpuid_vendor_id.mod.c @@ -58,7 +58,7 @@ static inline void native_cpuid(unsigned int function_id, cpuid_t r) { #endif } -#define VENDOR_ID_LEN 13 +#define VENDOR_ID_LEN 12 /* * FIXME: you have to make sure the vendor argument is at least lengthed @@ -74,12 +74,13 @@ static inline void cpuid_vendor_id(char vendor[VENDOR_ID_LEN]) { ((unsigned*) vendor)[0] = v[EBX]; ((unsigned*) vendor)[1] = v[EDX]; ((unsigned*) vendor)[2] = v[ECX]; - vendor[VENDOR_ID_LEN - 1] = '\0'; } int main(void) { char vendor_string[VENDOR_ID_LEN]; cpuid_vendor_id(vendor_string); - printf("CPU Vendor ID: '%s'\n", vendor_string); + fputs("CPU Vendor ID: '", stdout); + fwrite(vendor_string, sizeof(char), 12, stdout); + fputs("'\n", stdout); return 0; }