@@ -1725,13 +1725,13 @@ static gboolean set_part_type (struct fdisk_context *cxt, gint part_num, const g
17251725 const gchar * label_name = NULL ;
17261726 gchar * endptr = NULL ;
17271727 gint status = 0 ;
1728- gint part_id_int = 0 ;
1728+ guint64 part_id_int = 0 ;
17291729
17301730 /* check if part type/id is valid for MBR */
17311731 if (table_type == BD_PART_TABLE_MSDOS ) {
1732- part_id_int = g_ascii_strtoull (type_str , & endptr , 0 );
1732+ part_id_int = g_ascii_strtoll (type_str , & endptr , 0 );
17331733
1734- if (part_id_int == 0 || endptr == NULL || * endptr != '\0' ) {
1734+ if (part_id_int <= 0 || part_id_int > 0xFF || endptr == NULL || * endptr != '\0' ) {
17351735 g_set_error (error , BD_PART_ERROR , BD_PART_ERROR_INVAL ,
17361736 "Invalid partition id given: '%s'." , type_str );
17371737 return FALSE;
@@ -1773,18 +1773,6 @@ static gboolean set_part_type (struct fdisk_context *cxt, gint part_num, const g
17731773 return FALSE;
17741774 }
17751775
1776- if (table_type == BD_PART_TABLE_MSDOS ) {
1777- /* for GPT types unknown by libfdisk might still be valid */
1778- status = fdisk_parttype_is_unknown (ptype );
1779- if (status != 0 ) {
1780- g_set_error (error , BD_PART_ERROR , BD_PART_ERROR_INVAL ,
1781- "Invalid partition type given: '%s'." , type_str );
1782- fdisk_unref_parttype (ptype );
1783- fdisk_unref_partition (pa );
1784- return FALSE;
1785- }
1786- }
1787-
17881776 status = fdisk_set_partition_type (cxt , part_num , ptype );
17891777 if (status != 0 ) {
17901778 g_set_error (error , BD_PART_ERROR , BD_PART_ERROR_FAIL ,
0 commit comments