]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/tarstrm.cpp
correct some compatibility problems with the existing Unicode-mode code (#9513),...
[wxWidgets.git] / src / common / tarstrm.cpp
index 32b55f3a7ba190e24539542eb85dfa77a1146452..b763de5a2e1d7796fbd8effb52b7ab21fc97f8e8 100644 (file)
@@ -362,7 +362,8 @@ static wxString wxTarUserName(int uid)
     wxCharBuffer buf(bufsize);
     struct passwd pw;
 
-    if (getpwuid_r(uid, &pw, buf.data(), bufsize, &ppw) == 0)
+    memset(&pw, 0, sizeof(pw));
+    if (getpwuid_r(uid, &pw, buf.data(), bufsize, &ppw) == 0 && pw.pw_name)
         return wxString(pw.pw_name, wxConvLibc);
 #else
     if ((ppw = getpwuid(uid)) != NULL)
@@ -384,7 +385,8 @@ static wxString wxTarGroupName(int gid)
     wxCharBuffer buf(bufsize);
     struct group gr;
 
-    if (getgrgid_r(gid, &gr, buf.data(), bufsize, &pgr) == 0)
+    memset(&gr, 0, sizeof(gr));
+    if (getgrgid_r(gid, &gr, buf.data(), bufsize, &pgr) == 0 && gr.gr_name)
         return wxString(gr.gr_name, wxConvLibc);
 #else
     if ((pgr = getgrgid(gid)) != NULL)