Fix possible NULL pointer dereference in afh_get_header().
authorAndre Noll <maan@systemlinux.org>
Tue, 17 Mar 2009 22:58:58 +0000 (23:58 +0100)
committerAndre Noll <maan@systemlinux.org>
Tue, 17 Mar 2009 22:58:58 +0000 (23:58 +0100)
afh_common.c

index aa7f3d9..8c0eed2 100644 (file)
@@ -256,9 +256,10 @@ uint32_t afh_get_largest_chunk_size(struct afh_info *afhi)
  */
 void afh_get_header(struct afh_info *afhi, void *map, const char **buf, size_t *len)
 {
  */
 void afh_get_header(struct afh_info *afhi, void *map, const char **buf, size_t *len)
 {
-       if (!map || !afhi || ! afhi->header_len) {
+       if (!map || !afhi || !afhi->header_len) {
                *buf = NULL;
                *len = 0;
                *buf = NULL;
                *len = 0;
+               return;
        }
        *len = afhi->header_len;
        *buf = map + afhi->header_offset;
        }
        *len = afhi->header_len;
        *buf = map + afhi->header_offset;