Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 15835 | Differences between
and this patch

Collapse All | Expand All

(-)lsraid.c.orig (-8 / +11 lines)
Lines 1032-1039 Link Here
1032
    FILE *proc;
1032
    FILE *proc;
1033
    int major, minor, rc;
1033
    int major, minor, rc;
1034
    char name[MAX_LINE_LENGTH];
1034
    char name[MAX_LINE_LENGTH];
1035
    char *line = malloc(MAX_LINE_LENGTH);
1035
    char *line = malloc(MAX_LINE_LENGTH*sizeof(char));
1036
    char *current_read = malloc(MAX_LINE_LENGTH);
1036
    char *current_read = malloc(MAX_LINE_LENGTH*sizeof(char));
1037
    struct stat stat_buf;
1037
    struct stat stat_buf;
1038
1038
1039
    if (!ctxt || !ctxt->devtable)
1039
    if (!ctxt || !ctxt->devtable)
Lines 1054-1067 Link Here
1054
        if ((fgets(current_read, MAX_LINE_LENGTH, proc)) == NULL)
1054
        if ((fgets(current_read, MAX_LINE_LENGTH, proc)) == NULL)
1055
            goto out;
1055
            goto out;
1056
        strcpy(line, (const char*) current_read);
1056
        strcpy(line, (const char*) current_read);
1057
1057
      
1058
        while (strlen(current_read) == (MAX_LINE_LENGTH-1))
1058
	while (strlen(current_read) == (MAX_LINE_LENGTH-1))
1059
        {
1059
        {
1060
            int old_length = strlen(line);
1060
            if (current_read[MAX_LINE_LENGTH - 2] != '\n') {
1061
            line = realloc(line, old_length + MAX_LINE_LENGTH);
1061
	      int old_length = strlen(line);
1062
            if ((fgets(current_read, MAX_LINE_LENGTH, proc)) == NULL)
1062
              line = realloc(line, old_length + MAX_LINE_LENGTH);
1063
              if ((fgets(current_read, MAX_LINE_LENGTH, proc)) == NULL)
1063
                goto out;
1064
                goto out;
1064
            strcpy(line + old_length, current_read);
1065
              strcpy(line + old_length, current_read);
1066
	    } /* if (current_read....*/
1067
	    else break;
1065
        }
1068
        }
1066
1069
1067
        name[0] = 0;
1070
        name[0] = 0;

Return to bug 15835