Message: "err:psdrv:PSDRV_PPDGetNextTuple Line too long."

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

When my application opens a URL in Firefox with more than 257 characters, the URL is truncated and the message below.

"Err: psdrv: PSDRV_PPDGetNextTuple Line too long."

I noted that this limitation may be due to the following code. See line 00363.


Code:

00354 /*********************************************************************
00355  *
00356  *          PSDRV_PPDGetNextTuple
00357  *
00358  * Gets the next Keyword Option Value tuple from the file. Allocs space off
00359  * the process heap which should be free()ed by the caller if not needed.
00360  */
00361 static BOOL PSDRV_PPDGetNextTuple(FILE *fp, PPDTuple *tuple)
00362 {
00363     char line[257], *opt, *cp, *trans, *endkey;
00364     BOOL gotoption;
00365 
00366  start:
00367 
00368     gotoption = TRUE;
00369     opt = NULL;
00370     memset(tuple, 0, sizeof(*tuple));
00371 
00372     do {
00373         if(!fgets(line, sizeof(line), fp))
00374             return FALSE;
00375       if(line[0] == '*' && line[1] != '%' && strncmp(line, "*End", 4))
00376           break;
00377     } while(1);
00378 
00379     if(line[strlen(line)-1] != '\n') {
00380         ERR("Line too long.\n");
00381       goto start;
00382     }
00383 
00384     for(cp = line; !isspace(*cp) && *cp != ':'; cp++)
00385         ;
00386 
00387     endkey = cp;
00388     if(*cp == ':') { /* <key>: */
00389         gotoption = FALSE;
00390     } else {
00391       while(isspace(*cp))
00392           cp++;
00393       if(*cp == ':') { /* <key>  : */
00394           gotoption = FALSE;
00395       } else { /* <key> <option> */
00396           opt = cp;
00397       }
00398     }
00399 
00400     tuple->key = HeapAlloc( PSDRV_Heap, 0, endkey - line + 1 );
00401     if(!tuple->key) return FALSE;
00402 
00403     memcpy(tuple->key, line, endkey - line);
00404     tuple->key[endkey - line] = '\0';
00405 
00406     if(gotoption) { /* opt points to 1st non-space character of the option */
00407         cp = strpbrk(opt, ":/");
00408       if(!cp) {
00409           ERR("Error in line '%s'?\n", line);
00410             HeapFree(GetProcessHeap(), 0, tuple->key);
00411           goto start;
00412       }
00413       tuple->option = HeapAlloc( PSDRV_Heap, 0, cp - opt + 1 );
00414       if(!tuple->option) return FALSE;
00415       memcpy(tuple->option, opt, cp - opt);
00416       tuple->option[cp - opt] = '\0';
00417       if(*cp == '/') {
00418           char *buf;
00419           trans = cp + 1;
00420           cp = strchr(trans, ':');
00421           if(!cp) {
00422               ERR("Error in line '%s'?\n", line);
00423                 HeapFree(GetProcessHeap(), 0, tuple->option);
00424                 HeapFree(GetProcessHeap(), 0, tuple->key);
00425             goto start;
00426           }
00427           buf = HeapAlloc( PSDRV_Heap, 0, cp - trans + 1 );
00428           if(!buf) return FALSE;
00429           memcpy(buf, trans, cp - trans);
00430           buf[cp - trans] = '\0';
00431           tuple->opttrans = PSDRV_PPDDecodeHex(buf);
00432           HeapFree( PSDRV_Heap, 0, buf );
00433       }
00434     }
00435 
00436     /* cp should point to a ':', so we increment past it */
00437         cp++;
00438 
00439     while(isspace(*cp))
00440         cp++;
00441 
00442     switch(*cp) {
00443     case '"':
00444         if( (!gotoption && strncmp(tuple->key, "*?", 2) ) ||
00445            !strncmp(tuple->key, "*JCL", 4))
00446           PSDRV_PPDGetQuotedValue(fp, cp, tuple);
00447         else
00448           PSDRV_PPDGetInvocationValue(fp, cp, tuple);
00449       break;
00450 
00451     case '^':
00452         PSDRV_PPDGetSymbolValue(cp, tuple);
00453       break;
00454 
00455     default:
00456         PSDRV_PPDGetStringValue(cp, tuple);
00457     }
00458     return TRUE;
00459 }




Source: http://wine.sourcearchive.com/lines/1.0.1-0ubuntu2/ppd_8c-source.html

Is there any way around this limitation? 

Thank you.







[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux