fsid - clear buffer before reading
authorAlex Hornung <ahornung@gmail.com>
Wed, 24 Nov 2010 17:20:03 +0000 (17:20 +0000)
committerAlex Hornung <ahornung@gmail.com>
Wed, 24 Nov 2010 17:20:03 +0000 (17:20 +0000)
sbin/fsid/hammer.c
sbin/fsid/ufs.c

index 9c9943f..cb0edea 100644 (file)
@@ -48,6 +48,7 @@ hammer_probe(const char *dev)
                return 0;
        }
 
+       bzero(buffer, sizeof(buffer));
        ret = read(fd, &buffer, sizeof(buffer));
        if (ret < 0) {
                close(fd);
@@ -77,6 +78,7 @@ hammer_volname(const char *dev)
                return NULL;
        }
 
+       bzero(buffer, sizeof(buffer));
        ret = read(fd, &buffer, sizeof(buffer));
        if (ret < 0) {
                close(fd);
index 3e85b8a..a3b43f0 100644 (file)
@@ -52,6 +52,7 @@ ufs_probe(const char *dev)
        if (ret < 0)
                return 0;
 
+       bzero(buffer, sizeof(buffer));
        ret = read(fd, &buffer, SBSIZE);
        if (ret < 0) {
                close(fd);
@@ -84,6 +85,7 @@ ufs_volname(const char *dev)
        if (ret < 0)
                return NULL;
 
+       bzero(buffer, sizeof(buffer));
        ret = read(fd, &buffer, SBSIZE);
        if (ret < 0) {
                close(fd);