Changeset 199
- Timestamp:
- 04/20/10 16:01:16 (15 years ago)
- Location:
- Evidence
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Evidence/DColl.cc
r192 r199 221 221 char *Token = strtok(Info->getString(), "+-!@"); 222 222 while (Token != NULL) { 223 if (*Info->getString()=='-' || *Info->getString()=='!') ; //RemoveService(string(Token)+"/SERVICE_LIST");223 if (*Info->getString()=='-' || *Info->getString()=='!') RemoveService(string(Token)+"/SERVICE_LIST"); 224 224 else AddService(string(Token)+"/SERVICE_LIST"); 225 225 Token = strtok(NULL, "|"); // Skip server IP address … … 239 239 if (strstr(Type, "|CMD")==NULL && strstr(Type, "|RPC")==NULL) { 240 240 // Add or remove service 241 if (*Info->getString()=='-' || *Info->getString()=='!') ; //RemoveService(Name);241 if (*Info->getString()=='-' || *Info->getString()=='!') RemoveService(Name); 242 242 else AddService(Name); 243 243 } … … 350 350 // ====== Part D: Handle history service === 351 351 // 352 352 353 353 if (Info->getSize() == 0) return; 354 354 … … 468 468 if (Name == List[i].DataItem->getName()) return; 469 469 } 470 470 471 // Set minimum required change by comparing to regular expressions 471 472 struct Item New; 472 473 // Set minimum required change by comparing to regular expressions474 473 New.MinAbsChange = 0; 475 474 New.HistSize = 0; … … 505 504 } 506 505 } 507 506 508 507 // Subscribe to service 509 508 New.DataItem = new DimStampedInfo(Name.c_str(), NO_LINK, this); -
Evidence/Evidence.cc
r187 r199 240 240 char *Text; 241 241 242 // Safety check 243 if (Item->getSize() < 1) return NULL; 244 242 245 // Structure: print hex representation (3 characters per byte) 243 246 if (strlen(Item->getFormat()) != 1) { 244 if ((Text = (char *) malloc(3*Item->getSize()+1)) != NULL) { 245 for (int i=0; i<Item->getSize(); i++) sprintf(Text+3*i, "%02x", *((char *) Item->getData() + i)); 246 } 247 int Size = 3*Item->getSize()+1, N; 248 if ((Text = (char *) malloc(Size)) == NULL) return NULL; 249 250 char *CurrPos = Text; 251 for (int i=0; i<Item->getSize(); i++) { 252 N = snprintf(CurrPos, Size, "%02x ", *((char *) Item->getData() + i)); 253 if (N<0 || N>=Size) { 254 free(Text); 255 if (asprintf(&Text, "Structure length %d bytes, buffer overflow in ToString()", Item->getSize()) == -1) return NULL; 256 else return Text; 257 } 258 Size -= N; 259 CurrPos += N; 260 } 247 261 return Text; 248 262 }
Note:
See TracChangeset
for help on using the changeset viewer.