]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/staging/iio/Documentation/iio_utils.h
Staging: iio-utils: fix memory overflow for dynamically allocateded memory to hold...
[net-next-2.6.git] / drivers / staging / iio / Documentation / iio_utils.h
index a4555e6f133f0f4cca98924a6085aa8b7f0b6ad0..014f6684faba94f8ba6c28fcd606a131050bfdde 100644 (file)
@@ -62,9 +62,8 @@ inline int find_type_by_name(const char *name, const char *type)
                                        1) != 0) {
                                filename = malloc(strlen(iio_dir)
                                                + strlen(type)
-                                               + 1
                                                + numstrlen
-                                               + 1);
+                                               + 6);
                                if (filename == NULL)
                                        return -ENOMEM;
                                sprintf(filename, "%s%s%d/name",