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

Collapse All | Expand All

(-)update-mime-database.c (-4 / +41 lines)
Lines 840-846 Link Here
840
	unsigned long value;
840
	unsigned long value;
841
	int b;
841
	int b;
842
842
843
	value = strtol(in, &end, 0);
843
	value = strtoul(in, &end, 0);
844
	if (errno == ERANGE) {
845
		g_set_error(error, MIME_ERROR, 0,
846
			    "Number out-of-range (%s should fit in %d bytes)",
847
			    in, bytes);
848
		return;
849
	}
850
844
	if (*end != '\0')
851
	if (*end != '\0')
845
	{
852
	{
846
		g_set_error(error, MIME_ERROR, 0, "Value is not a number");
853
		g_set_error(error, MIME_ERROR, 0, "Value is not a number");
Lines 865-873 Link Here
865
	if (in_mask)
872
	if (in_mask)
866
	{
873
	{
867
		int b;
874
		int b;
868
		long mask;
875
		unsigned long mask;
869
		
876
		
870
		mask = strtol(in_mask, &end, 0);
877
		mask = strtoul(in_mask, &end, 0);
878
		if (errno == ERANGE) {
879
			g_set_error(error, MIME_ERROR, 0,
880
				    "Mask out-of-range (%s should fit in %d bytes)",
881
				    in_mask, bytes);
882
			return;
883
		}
884
885
871
		if (*end != '\0')
886
		if (*end != '\0')
872
		{
887
		{
873
			g_set_error(error, MIME_ERROR, 0,
888
			g_set_error(error, MIME_ERROR, 0,
Lines 1022-1032 Link Here
1022
	}
1037
	}
1023
1038
1024
	match->range_start = strtol(offset, &end, 10);
1039
	match->range_start = strtol(offset, &end, 10);
1040
	if (errno == ERANGE) {
1041
		char *number;
1042
		number = g_strndup(offset, end-offset);
1043
		g_set_error(error, MIME_ERROR, 0,
1044
			    "Number out-of-range (%s should fit in 4 bytes)",
1045
			    number);
1046
		g_free(number);
1047
		return;
1048
	}
1049
1025
	if (*end == ':' && end[1] && match->range_start >= 0)
1050
	if (*end == ':' && end[1] && match->range_start >= 0)
1026
	{
1051
	{
1027
		int last;
1052
		int last;
1053
		char *begin;
1054
1055
		begin = end + 1;
1056
		last = strtol(begin, &end, 10);
1057
		if (errno == ERANGE) {
1058
			char *number;
1059
			number = g_strndup(begin, end-begin);
1060
			g_set_error(error, MIME_ERROR, 0,
1061
				    "Number out-of-range (%s should fit in 8 bytes)",
1062
				    number);
1063
			g_free(number);
1064
			return;
1065
		}
1028
1066
1029
		last = strtol(end + 1, &end, 10);
1030
		if (*end == '\0' && last >= match->range_start)
1067
		if (*end == '\0' && last >= match->range_start)
1031
			match->range_length = last - match->range_start + 1;
1068
			match->range_length = last - match->range_start + 1;
1032
		else
1069
		else

Return to bug 84214