blob: d0878a70a2f5cb17281c81fb78223aacb4c488a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include <string>
#include <iostream>
// for memcpy
#include <cstring>
#include <apt-pkg/error.h>
#include <apt-pkg/gpgv.h>
#include "sources.h"
bool DscExtract::TakeDsc(const void *newData, unsigned long newSize)
{
if(newSize > maxSize)
return _error->Error("DSC data is too large %lu!", newSize);
if (newSize == 0)
{
Length = 0;
return true;
}
memcpy(Data, newData, newSize);
Length = newSize;
return true;
}
bool DscExtract::Read(std::string FileName)
{
FileFd F;
if (OpenMaybeClearSignedFile(FileName, F) == false)
return false;
unsigned long long const FSize = F.FileSize();
if(FSize > maxSize)
return _error->Error("DSC file '%s' is too large!",FileName.c_str());
if (F.Read(Data, FSize) == false)
return false;
Length = FSize;
IsClearSigned = (FileName != F.Name());
return true;
}
|