{
FILE *fp;
unsigned int i, major, indirect, count = 0;
- char buf[IOC_LINESIZ + 1];
- char cfmt[IOC_FMTLEN + 1];
- char dfmt[IOC_FMTLEN + 1];
- char pfmt[IOC_FMTLEN + 1];
- char desc[IOC_DESCLEN + 1];
+ char buf[IOC_LINESIZ];
+ char cfmt[IOC_FMTLEN];
+ char dfmt[IOC_FMTLEN];
+ char pfmt[IOC_FMTLEN];
+ char desc[IOC_DESCLEN];
struct ioc_entry *iocp = NULL;
struct blk_config *blkp = NULL;
char ioconf_name[64];
/* Init ioc_refnr array */
memset(ioc_refnr, 0, sizeof(ioc_refnr));
- while (fgets(buf, IOC_LINESIZ, fp)) {
+ while (fgets(buf, IOC_LINESIZ - 1, fp)) {
if ((*buf == '#') || (*buf == '\n'))
continue;
iocp->desc = ioconf[indirect]->blkp->desc;
}
else {
- IOC_ALLOC(iocp->desc, char, IOC_DESCLEN + 1);
- strncpy(iocp->desc, desc, IOC_DESCLEN);
+ IOC_ALLOC(iocp->desc, char, IOC_DESCLEN);
+ strncpy(iocp->desc, desc, IOC_DESCLEN - 1);
}
ioc_refnr[indirect]++;
ioconf[major] = iocp;
* exception info
*/
xblkp->ext_minor = iocp->ctrlno;
- strncpy(xblkp->ext_name, blkp->name, IOC_NAMELEN + 1);
- xblkp->ext_name[IOC_NAMELEN] = '\0';
+ strncpy(xblkp->ext_name, blkp->name, IOC_NAMELEN);
+ xblkp->ext_name[IOC_NAMELEN - 1] = '\0';
xblkp->ext = 1;
continue;
}
/* basename of device + provided string + controller # */
if (*cfmt == '*') {
- strncpy(blkp->cfmt, blkp->name, IOC_FMTLEN);
- blkp->cfmt[IOC_FMTLEN] = '\0';
+ strncpy(blkp->cfmt, blkp->name, IOC_FMTLEN - 1);
+ blkp->cfmt[IOC_FMTLEN - 1] = '\0';
}
else {
sprintf(blkp->cfmt, "%s%s%%d", blkp->name, cfmt);
break;
case '%':
- strncpy(blkp->dfmt, dfmt + 1, IOC_FMTLEN);
+ strncpy(blkp->dfmt, dfmt + 1, IOC_FMTLEN - 1);
/* fallthrough to next case */
case 'd':
blkp->cconv = ioc_ito10;
iocp->desc = NULL;
iocp->basemajor = major;
ioconf[major] = iocp;
- strncpy(blkp->desc, desc, IOC_DESCLEN);
+ strncpy(blkp->desc, desc, IOC_DESCLEN - 1);
blkp = NULL; iocp = NULL;
++count;
}
char *ioc_name(unsigned int major, unsigned int minor)
{
- static char name[IOC_DEVLEN + 1];
+ static char name[IOC_DEVLEN];
struct ioc_entry *p;
int base, offset;
/* Is this an extension record? */
if (p->blkp->ext && (p->blkp->ext_minor == minor)) {
- strncpy(name, p->blkp->ext_name, IOC_DEVLEN + 1);
- name[IOC_DEVLEN] = '\0';
+ strncpy(name, p->blkp->ext_name, IOC_DEVLEN);
+ name[IOC_DEVLEN - 1] = '\0';
return (name);
}
#include "sysconfig.h"
-#define IOC_NAMELEN 31
-#define IOC_DESCLEN 63
-#define IOC_DEVLEN 47
-#define IOC_LINESIZ 255
-#define IOC_FMTLEN 15
+#define IOC_NAMELEN 32
+#define IOC_DESCLEN 64
+#define IOC_DEVLEN 48
+#define IOC_LINESIZ 256
+#define IOC_FMTLEN 16
#ifndef MINORBITS
#define MINORBITS 20
struct blk_config {
- char name[IOC_NAMELEN + 1]; /* device basename */
- char cfmt[IOC_FMTLEN + 1]; /* controller format string */
- char dfmt[IOC_FMTLEN + 1]; /* disk format string */
- char pfmt[IOC_FMTLEN + 1]; /* partition format string */
+ char name[IOC_NAMELEN]; /* device basename */
+ char cfmt[IOC_FMTLEN]; /* controller format string */
+ char dfmt[IOC_FMTLEN]; /* disk format string */
+ char pfmt[IOC_FMTLEN]; /* partition format string */
/* ctrlno is in the ioc_entry */
unsigned int ctrl_explicit; /* use "cN" in name */
unsigned int dcount; /* number of devices handled by this major */
unsigned int pcount; /* partitions per device */
- char desc[IOC_DESCLEN + 1];
+ char desc[IOC_DESCLEN];
/* disk info unit # conversion function */
char *(*cconv)(unsigned int);
/* extension properties (all this for initrd?) */
- char ext_name[IOC_NAMELEN + 1];
+ char ext_name[IOC_NAMELEN];
unsigned int ext; /* flag - this is an extension record */
unsigned int ext_minor; /* which minor does this apply to */
};