From: <sm...@us...> - 2006-05-02 06:05:55
|
Update of /cvsroot/ceps/ceps-providor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1890 Modified Files: printer_info.c Log Message: Used strncpy to ensure that upto maximum field length of input information can be copied to the destination. - sarath Index: printer_info.c =================================================================== RCS file: /cvsroot/ceps/ceps-providor/printer_info.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** printer_info.c 16 Mar 2006 06:30:33 -0000 1.40 --- printer_info.c 2 May 2006 06:05:50 -0000 1.41 *************** *** 40,44 **** /* sprintf(ret->sharename, "\\\\CEPS\\%s", (devname) ? devname : ""); */ strcpy(ret->portname, "CEPS Printer Port"); ! strcpy(ret->drivername, TEST_MODEL); /* strcpy(ret->drivername, "NO DRIVER AVAILABLE FOR THIS PRINTER"); */ strcpy(ret->comment, "A test printer"); --- 40,44 ---- /* sprintf(ret->sharename, "\\\\CEPS\\%s", (devname) ? devname : ""); */ strcpy(ret->portname, "CEPS Printer Port"); ! strncpy(ret->drivername, TEST_MODEL,FSTRING_LEN - 1); /* strcpy(ret->drivername, "NO DRIVER AVAILABLE FOR THIS PRINTER"); */ strcpy(ret->comment, "A test printer"); *************** *** 113,117 **** (*ppi)->flags = PRINTER_ENUM_ICON2 | PRINTER_ENUM_CONTAINER; if ( (desc = SddbFldFind("desc", regionrec)) != NULL ) { ! strcpy((*ppi)->location, desc); } if ( (region = SddbFldFind("region", regionrec)) != NULL ) { --- 113,117 ---- (*ppi)->flags = PRINTER_ENUM_ICON2 | PRINTER_ENUM_CONTAINER; if ( (desc = SddbFldFind("desc", regionrec)) != NULL ) { ! strncpy((*ppi)->location, desc,FSTRING_LEN - 1); } if ( (region = SddbFldFind("region", regionrec)) != NULL ) { *************** *** 140,144 **** (*ppi)->flags = PRINTER_ENUM_ICON2 | PRINTER_ENUM_CONTAINER; if ( (desc = SddbFldFind("desc", loccoderec)) != NULL ) { ! strcpy((*ppi)->location, desc); } if ( (loccode = SddbFldFind("loccode", loccoderec)) != NULL ) { --- 140,144 ---- (*ppi)->flags = PRINTER_ENUM_ICON2 | PRINTER_ENUM_CONTAINER; if ( (desc = SddbFldFind("desc", loccoderec)) != NULL ) { ! strncpy((*ppi)->location, desc,FSTRING_LEN - 1); } if ( (loccode = SddbFldFind("loccode", loccoderec)) != NULL ) { *************** *** 168,174 **** *ppi = construct_default_container_PRINTER_INFO(); (*ppi)->flags = PRINTER_ENUM_ICON8; ! strcpy((*ppi)->location, cprinter); if ( (desc = SddbFldFind("contact", mainrec)) != NULL ) { ! strcpy((*ppi)->comment, desc); } strcpy((*ppi)->printername, "\\\\CEPS\\"); --- 168,174 ---- *ppi = construct_default_container_PRINTER_INFO(); (*ppi)->flags = PRINTER_ENUM_ICON8; ! strncpy((*ppi)->location, cprinter,FSTRING_LEN - 1); if ( (desc = SddbFldFind("contact", mainrec)) != NULL ) { ! strncpy((*ppi)->comment, desc,PSTRING_LEN - 1); } strcpy((*ppi)->printername, "\\\\CEPS\\"); *************** *** 193,200 **** pichain->flags=PRINTER_ENUM_ICON3 | PRINTER_ENUM_CONTAINER; if ( (desc = SddbFldFind( "sgrpname", sgrouprec )) ) { ! strcpy(pichain->location, desc ); } if ( (desc = SddbFldFind( "desc", sgrouprec )) ) { ! strcpy(pichain->comment, desc ); } } --- 193,200 ---- pichain->flags=PRINTER_ENUM_ICON3 | PRINTER_ENUM_CONTAINER; if ( (desc = SddbFldFind( "sgrpname", sgrouprec )) ) { ! strncpy(pichain->location, desc,FSTRING_LEN - 1 ); } if ( (desc = SddbFldFind( "desc", sgrouprec )) ) { ! strncpy(pichain->comment, desc,PSTRING_LEN - 1 ); } } *************** *** 256,266 **** free(data); } else { ! report( "get_drsetting() cannot find 'data' for %s\n", pszRealName); } sp=SddbFldFind("contact", mainrec); ! strcpy(pi->comment, (sp) ? sp : ""); sp=SddbFldFind("location", mainrec); ! strcpy(pi->location, (sp) ? sp : ""); build_PRINTER_ENUM_VALUES_main(&(pi->specific), pszRealName, mainrec); --- 256,266 ---- free(data); } else { ! report( "get_drsetting() cannot find %s\n", pszRealName); } sp=SddbFldFind("contact", mainrec); ! strncpy(pi->comment, (sp) ? sp : "",PSTRING_LEN - 1); sp=SddbFldFind("location", mainrec); ! strncpy(pi->location, (sp) ? sp : "",FSTRING_LEN - 1); build_PRINTER_ENUM_VALUES_main(&(pi->specific), pszRealName, mainrec); *************** *** 560,564 **** sprintf((*pi)->printername, "\\\\CEPS\\%s", devname ); /* strcpy((*pi)->sharename, (*pi)->printername);*/ ! strcpy((*pi)->sharename, devname ); strcpy((*pi)->portname, "CEPS Printer Port"); --- 560,564 ---- sprintf((*pi)->printername, "\\\\CEPS\\%s", devname ); /* strcpy((*pi)->sharename, (*pi)->printername);*/ ! strncpy((*pi)->sharename, devname,FSTRING - 1 ); strcpy((*pi)->portname, "CEPS Printer Port"); |