Kaynağa Gözat

:bug: Suppr caractères étrange après nom commande

Loquicom 6 yıl önce
ebeveyn
işleme
b1aa9c3eec
6 değiştirilmiş dosya ile 2 ekleme ve 1 silme
  1. 0 0
      f1
  2. 0 0
      f2
  3. 0 0
      f3
  4. 0 0
      f4
  5. 0 0
      f5
  6. 2 1
      parser.c





+ 2 - 1
parser.c

@@ -423,7 +423,8 @@ int split_command(Command* c, char* cmd){
         else if(*cmd == delim && chercheFin){
             chercheFin = false;
             //Recup le mot
-            c->argv[i] = malloc(sizeof(char) * length);
+            c->argv[i] = malloc(sizeof(char) * (length + 1));
+            memset(c->argv[i], 0, length + 1);
             strncpy(c->argv[i++], deb, length);
         }
         //Incremente