Kaynağa Gözat

* Fix off-by-1 error in string in userfile processing

Bryan Drewery 16 yıl önce
ebeveyn
işleme
7ce31c204d
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  1. 1 1
      src/users.c

+ 1 - 1
src/users.c

@@ -626,7 +626,7 @@ int stream_readuserfile(bd::Stream& stream, struct userrec **ret)
   while (stream.tell() < stream.length()) {
     s = buf;
     str = stream.getline(sizeof(buf));
-    strlcpy(s, str.c_str(), std::min(str.length(), sizeof(buf)));
+    strlcpy(s, str.c_str(), std::min(str.length() + 1, sizeof(buf)));
     remove_crlf(s);
     if (1) {
       line++;