@@ -121,6 +121,7 @@ static int
121121repo_read_index (struct xbps_repo * repo , struct archive * ar )
122122{
123123 struct archive_entry * entry ;
124+ const char * pname ;
124125 char * buf ;
125126 int r ;
126127
@@ -129,7 +130,10 @@ repo_read_index(struct xbps_repo *repo, struct archive *ar)
129130 return r ;
130131
131132 /* index.plist */
132- if (strcmp (archive_entry_pathname (entry ), XBPS_REPODATA_INDEX ) != 0 ) {
133+ pname = archive_entry_pathname (entry );
134+ if (!pname )
135+ xbps_unreachable ();
136+ if (strcmp (pname , XBPS_REPODATA_INDEX ) != 0 ) {
133137 xbps_error_printf ("failed to read repository index: %s: unexpected archive entry\n" ,
134138 repo -> uri );
135139 r = - EINVAL ;
@@ -175,14 +179,18 @@ static int
175179repo_read_meta (struct xbps_repo * repo , struct archive * ar )
176180{
177181 struct archive_entry * entry ;
182+ const char * pname ;
178183 char * buf ;
179184 int r ;
180185
181186 r = repo_read_next (repo , ar , & entry );
182187 if (r < 0 )
183188 return r ;
184189
185- if (strcmp (archive_entry_pathname (entry ), XBPS_REPODATA_META ) != 0 ) {
190+ pname = archive_entry_pathname (entry );
191+ if (!pname )
192+ xbps_unreachable ();
193+ if (strcmp (pname , XBPS_REPODATA_META ) != 0 ) {
186194 xbps_error_printf ("failed to read repository metadata: %s: unexpected archive entry\n" ,
187195 repo -> uri );
188196 r = - EINVAL ;
@@ -237,6 +245,7 @@ static int
237245repo_read_stage (struct xbps_repo * repo , struct archive * ar )
238246{
239247 struct archive_entry * entry ;
248+ const char * pname ;
240249 int r ;
241250
242251 r = repo_read_next (repo , ar , & entry );
@@ -249,7 +258,10 @@ repo_read_stage(struct xbps_repo *repo, struct archive *ar)
249258 return r ;
250259 }
251260
252- if (strcmp (archive_entry_pathname (entry ), XBPS_REPODATA_STAGE ) != 0 ) {
261+ pname = archive_entry_pathname (entry );
262+ if (!pname )
263+ xbps_unreachable ();
264+ if (strcmp (pname , XBPS_REPODATA_STAGE ) != 0 ) {
253265 xbps_error_printf ("failed to read repository stage: %s: unexpected archive entry\n" ,
254266 repo -> uri );
255267 r = - EINVAL ;
0 commit comments