Browse Source

fix a segfault bug in _DkGetCPUInfo

Chia-Che Tsai 8 years ago
parent
commit
ea27df1a1a
2 changed files with 2 additions and 2 deletions
  1. 1 1
      Pal/src/host/FreeBSD/db_main.c
  2. 1 1
      Pal/src/host/Linux/db_main.c

+ 1 - 1
Pal/src/host/FreeBSD/db_main.c

@@ -418,7 +418,7 @@ void _DkGetCPUInfo (PAL_CPU_INFO * ci)
 
     for (int i = 0 ; i < 32 ; i++) {
         if (!cpu_flags[i])
-            continue;
+            break;
 
         if (BIT_EXTRACT_LE(words[WORD_EDX], i, i + 1)) {
             int len = strlen(cpu_flags[i]);

+ 1 - 1
Pal/src/host/Linux/db_main.c

@@ -400,7 +400,7 @@ void _DkGetCPUInfo (PAL_CPU_INFO * ci)
 
     for (int i = 0 ; i < 32 ; i++) {
         if (!cpu_flags[i])
-            continue;
+            break;
 
         if (BIT_EXTRACT_LE(words[WORD_EDX], i, i + 1)) {
             int len = strlen(cpu_flags[i]);